3
Answers

trying to automate a crystyal report with export.

Sorry for the formatting...new to posting here I have done it in the past, I'm now having a problem when running a report. This is a c# console app that calls a crystal report and exports a pdf file. Of course process works fine locally, but whe I move the exe up to a server, an exception occurs that says >CrystalDecisions.CrystalReports.Engine.DataSourceException: The table '' could not be found. I do have other processes that do the exact same thing and they all work... Code is below:.. ReportDocument rpt = new ReportDocument(); ConnectionInfo connectionInfo = new ConnectionInfo(); TableLogOnInfo tableLogOnInfo; Database DB; Table table; Tables tables; //Log in connectionInfo.ServerName = "radsrvr"; connectionInfo.DatabaseName = "PRD_RADDATA"; connectionInfo.UserID = "XXXX"; connectionInfo.Password = "XXXX"; connectionInfo.IntegratedSecurity = false; connectionInfo.AllowCustomConnection = true; connectionInfo.Type = ConnectionInfoType.SQL; //Report for Diane.... rpt.Load(aPath + @"\signed reports in RIS.rpt"); rpt.SetParameterValue("Start_Date",start_date); rpt.SetParameterValue("End_Date",end_date); //Get Table info from report DB = rpt.Database; tables = DB.Tables; //Looping through all the tables in CR and apply connection info for(int i = 0; i < tables.Count; i++) { table = tables[ i ]; tableLogOnInfo = table.LogOnInfo; tableLogOnInfo.ConnectionInfo = connectionInfo; tableLogOnInfo.TableName = table; table.ApplyLogOnInfo(tableLogOnInfo); } string exportFileNamepdf = "RIS_Signed_Off_Reports_" + startdate.ToString("MMddyyyy") + ".pdf"; rpt.ExportToDisk(ExportFormatType.PortableDocFormat,exportFileNamepdf);
Answers (3)