Does anyone know how to use multiple .rpt files (crystal reports) in one application? I need to generate reports and directly save to .pdf but I'm not sure how to do it. I manage to do it when I’m using single .rpt file but I’m not sure how to generate report with multiple .rpt file. Can someone assist me with thid?
My coding:
ReportDocument cryRpt = new ReportDocument();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables;
cryRpt.Load("C:\\rptBilling.rpt");
crConnectionInfo.ServerName = "ServerName";
crConnectionInfo.DatabaseName = "DatabaseName";
crConnectionInfo.UserID = "userID";
crConnectionInfo.Password = "Password";
CrTables = cryRpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
cryRpt.SetParameterValue("@CollectionStartDate", "2011/09/14");
cryRpt.SetParameterValue("@CollectionEndDate", "2011/09/29");
cryRpt.SetParameterValue("@SpokeCode", "14");//country code
cryRpt.SetParameterValue("@UseCollectionDate", "1");//value can be set 0 or 1
cryRpt.SetParameterValue("@UseUploadDate", "0");//value can be set 0 or 1
cryRpt.SetParameterValue("@UploadStartDate", "2011/09/23");
cryRpt.SetParameterValue("@UploadEndDate", "2011/09/23");
cryRpt.ExportToDisk(ExportFormatType.PortableDocFormat, "e:\\1.pdf");