myReportDocument.SetDataSource(ds1)
CrystalReportViewer1.ReportSource = myReportDocument;
ReportDocument myReportDocument; BLLreport obj_report = new BLLreport(); protected void Page_Init(object sender, EventArgs e) { int reportid; reportid = Convert.ToInt32(Request.QueryString["reportid"]); switch (reportid) { case 1: { getrpt("crptfreemember.rpt"); string cat = Request.QueryString["cat"]; obj_report.category = cat; DataSet ds1 = new DataSet(); ds1 = obj_report.Fn_Print_freemem_Report(); myReportDocument.SetDataSource(ds1); myReportDocument.Refresh(); CrystalReportViewer1.ReportSource = myReportDocument; //CrystalReportViewer1.DataBind(); break; } case 2: { getrpt("crptpremium.rpt"); string cat = Request.QueryString["cat"]; obj_report.category = cat; DataSet ds1 = new DataSet(); ds1 = obj_report.Fn_Print_premmem_Report(); myReportDocument.SetDataSource(ds1); myReportDocument.Refresh(); CrystalReportViewer1.ReportSource = myReportDocument; //CrystalReportViewer1.DataBind(); break; } } } public void getrpt(string path) { TableLogOnInfos crtablelogoninfors = new TableLogOnInfos(); TableLogOnInfo crtablelogoninfo = new TableLogOnInfo(); ConnectionInfo crconnectioninfo = new ConnectionInfo(); Tables crtables; CrystalDecisions.CrystalReports.Engine.Table crTable; myReportDocument = new ReportDocument(); myReportDocument.Load(Server.MapPath(path)); crtables = myReportDocument.Database.Tables; for (int i = 0; i < crtables.Count; i++) { crconnectioninfo.ServerName = "xxxxx"; crconnectioninfo.DatabaseName = "xxxx"; crconnectioninfo.UserID = "xx"; crconnectioninfo.Password = "xxx"; crTable = crtables[i]; crtablelogoninfo = crTable.LogOnInfo; crtablelogoninfo.ConnectionInfo = crconnectioninfo; crTable.ApplyLogOnInfo(crtablelogoninfo); //crTable.Location = crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1); } }
myReportDocument.SetDataSource(ds1.Tables[0]);
myReportDocument.SetDataSource(ds1);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)