private ReportDocument report; private String reportName = "ABCrpt.rpt"; protected void NextButton_Click(object sender, EventArgs e) { this.BindReport(); this.rptviewer.ShowNextPage(); } private void BindReport() { if (Session["Rep"] == null) { Hashtable Params = new Hashtable(); Params.Add("StartDate", Convert.ToDateTime(this.StartDateFlexDevCalendar.GetDate)); Params.Add("EndDate", Convert.ToDateTime(this.EndDateFlexDevCalendar.GetDate)); report = new ReportDocument(); report.Load(Server.MapPath("EN/" + reportName )); TableLogOnInfos tblLogonInfos = new TableLogOnInfos(); TableLogOnInfo tblLogonInfo = new TableLogOnInfo(); ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.ServerName = "sokheng"; connectionInfo.UserID = "sa"; connectionInfo.Password = "1234"; connectionInfo.DatabaseName = "DatabaseABC"; foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in report.Database.Tables) { tblLogonInfo = tbl.LogOnInfo; tblLogonInfo.ConnectionInfo = connectionInfo; tbl.ApplyLogOnInfo(tblLogonInfo); } if (Params != null) { foreach (DictionaryEntry p in Params) { report.SetParameterValue(Convert.ToString(p.Key), Convert.ToDateTime(p.Value)); } } Session["Rep"] = report; } report = (ReportDocument)Session["Rep"]; this.rptviewer.ReportSource = report; this.rptviewer.DataBind(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)