private void LoadReport() { string foldername = MapPath("~/CS_REPORT/rpt/MTODPexemptionletter.rpt"); CrystalDecisions.Web.Parameter myparamss2 = new CrystalDecisions.Web.Parameter(); string tmp_acctcode = ""; string cardname = StringHelper.ReCodeCharacters(DropDownList1.Text); DataTable user_counterid = SqlDbHelper.getDataDT("SELECT cardcode FROM SAPSERVER.MATIMCO.dbo.OCRD WHERE cardname='" + cardname + "' GROUP BY cardcode"); foreach (DataRow acctCode in user_counterid.Rows) { tmp_acctcode = acctCode["cardcode"].ToString(); } myparamss2.DefaultValue = tmp_acctcode; myparamss2.Name = "Customer Code"; ReportDocument rpt1 = new ReportDocument(); // CrystalReportSource1.ReportDocument.SetDatabaseLogon("sa", "p@ssw0rd", "192.168.10.15", "MATIMCO"); rpt1.Load(foldername); CrystalDecisions.Web.Report rpt_web = new CrystalDecisions.Web.Report(); rpt_web.FileName = foldername; rpt_web.Parameters.Add(myparamss2); CrystalReportSource1.Report = rpt_web; CrystalReportSource1.Report.FileName = foldername; CrystalReportViewer1.ReportSource = CrystalReportSource1; TableLogOnInfos tblinfos = new TableLogOnInfos(); TableLogOnInfo tblinfo = new TableLogOnInfo(); tblinfo.ConnectionInfo.DatabaseName = "MATIMCO"; tblinfo.ConnectionInfo.UserID = "sa"; tblinfo.ConnectionInfo.Password = "******"; tblinfo.ConnectionInfo.ServerName = "192.168.10.15"; tblinfo.ConnectionInfo.IntegratedSecurity = false; tblinfo.ConnectionInfo.AllowCustomConnection = true; CrystalReportSource1.Report.Parameters.Add(myparamss2); CrystalReportViewer1.LogOnInfo.Add(tblinfo); CrystalReportViewer1.RefreshReport(); Label2.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { string foldername = Server.MapPath("~/CS_REPORT/rpt/Credit Investigation Tab Info.rpt"); try { CrystalDecisions.Web.Parameter acctcode = new CrystalDecisions.Web.Parameter(); string tmp_acctcode = ""; string cardcode = StringHelper.ReCodeCharacters(DropDownList1.Text); DataTable user_counterid = SqlDbHelper.getDataDT("SELECT acctcode FROM customerheader WHERE acctcode='" + cardcode + "' GROUP BY acctcode"); foreach (DataRow acctCode in user_counterid.Rows) { tmp_acctcode = acctCode["acctcode"].ToString(); } acctcode.Name = "Account Code"; acctcode.DefaultValue = tmp_acctcode; ReportDocument rpt1 = new ReportDocument(); rpt1.Load(foldername); CrystalDecisions.Web.Report rpt_web = new CrystalDecisions.Web.Report(); rpt_web.FileName = foldername; rpt_web.Parameters.Add(acctcode); CrystalReportSource1.Report = rpt_web; CrystalReportViewer1.ReportSource = CrystalReportSource1; TableLogOnInfos tblinfos = new TableLogOnInfos(); TableLogOnInfo tblinfo = new TableLogOnInfo(); tblinfo.ConnectionInfo.DatabaseName = "ARMS"; tblinfo.ConnectionInfo.UserID = "sa"; tblinfo.ConnectionInfo.Password = "******"; tblinfo.ConnectionInfo.ServerName = "192.168.10.13"; tblinfo.ConnectionInfo.IntegratedSecurity = false; tblinfo.ConnectionInfo.AllowCustomConnection = true; CrystalReportSource1.Report.Parameters.Add(acctcode); CrystalReportViewer1.LogOnInfo.Add(tblinfo); CrystalReportViewer1.RefreshReport(); Label2.Visible = false; } catch (Exception ex) { Label2.Visible = true; Label2.Text = "Error: " + ex.Message; } }
protected void Button1_Click(object sender, EventArgs e) { string foldername = Server.MapPath("~/CS_REPORT/rpt/mrktprogactivitiesupdate.rpt"); try { CrystalDecisions.Web.Parameter myparamss = new CrystalDecisions.Web.Parameter(); myparamss.DefaultValue = TextBox1.Text; myparamss.Name = "Marketing Program No"; ReportDocument rpt1 = new ReportDocument(); rpt1.Load(foldername); CrystalDecisions.Web.Report rpt_web = new CrystalDecisions.Web.Report(); rpt_web.FileName = foldername; rpt_web.Parameters.Add(myparamss); CrystalReportSource1.Report = rpt_web; CrystalReportViewer1.ReportSource = CrystalReportSource1; //CrystalReportSource1.Report.FileName = foldername; //CrystalReportSource1.Report.Parameters.Add(myparamss); //CrystalReportSource1.Report.Parameters.Add(myparamss2); TableLogOnInfos tblinfos = new TableLogOnInfos(); TableLogOnInfo tblinfo = new TableLogOnInfo(); tblinfo.ConnectionInfo.DatabaseName = "MATIMCO"; tblinfo.ConnectionInfo.UserID = "sa"; tblinfo.ConnectionInfo.Password = "******"; tblinfo.ConnectionInfo.ServerName = "192.168.10.15"; tblinfo.ConnectionInfo.IntegratedSecurity = false; tblinfo.ConnectionInfo.AllowCustomConnection = true; CrystalReportViewer1.LogOnInfo.Add(tblinfo); CrystalReportViewer1.RefreshReport(); } catch (Exception ex) { Label2.Text = "Error-" + ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { var fileName = Request.QueryString["fileName"]; var filePath = String.Format("{0}\\{1}", Server.MapPath("~/Reports"), fileName); var fileInfo = new FileInfo(filePath); if (fileInfo.Exists == false) { ReturnErrorStatusAndShowMessage(fileName); return; } var connectionInfo = GetConnectionInfo(); CrystalDecisions.Web.Report webReport = new CrystalDecisions.Web.Report(); webReport.FileName = filePath; CrystalReportSource.Report = webReport; SetDBLogonForReport(connectionInfo, CrystalReportSource.ReportDocument); CrystalReportViewer.Error += new CrystalDecisions.Web.ErrorEventHandler(delegate(Object o, CrystalDecisions.Web.ErrorEventArgs errorArgs) { //ignore missing parameters error (not an error) if (!errorArgs.ErrorMessage.Contains("Missing parameter values")) { ShowFeaturedText(String.Format("Error {0}", errorArgs.ErrorMessage)); } }); CrystalReportViewer.DataBind(); CrystalReportViewer.RefreshReport(); }
protected void Button1_Click(object sender, EventArgs e) { string foldername = Server.MapPath("~/CS_REPORT/rpt/List of Customers.rpt"); try { ReportDocument rpt1 = new ReportDocument(); CrystalDecisions.Web.Report rpt_web = new CrystalDecisions.Web.Report(); CrystalDecisions.Web.Parameter par_date = new CrystalDecisions.Web.Parameter(); par_date.Name = "AsOfDate"; par_date.DefaultValue = txt_date.Text; rpt_web.Parameters.Add(par_date); CrystalReportSource1.Report.Parameters.Add(par_date); rpt1.Load(foldername); rpt_web.FileName = foldername; CrystalReportSource1.Report = rpt_web; CrystalReportViewer1.ReportSource = CrystalReportSource1; TableLogOnInfos tblinfos = new TableLogOnInfos(); TableLogOnInfo tblinfo = new TableLogOnInfo(); tblinfo.ConnectionInfo.DatabaseName = "ARMS"; tblinfo.ConnectionInfo.UserID = "sa"; tblinfo.ConnectionInfo.Password = "******"; tblinfo.ConnectionInfo.ServerName = "192.168.10.13"; tblinfo.ConnectionInfo.IntegratedSecurity = false; tblinfo.ConnectionInfo.AllowCustomConnection = true; CrystalReportViewer1.LogOnInfo.Add(tblinfo); CrystalReportViewer1.RefreshReport(); } catch (Exception ex) { } }