I have a report and when clicked on link subreport i get Database login form.I have given all the necessary connection strings but still it asks for login info.sub reports opens in my local system but when installed in Client system i get this problem. what am i missing or what should i do ?
+1
A:
I have found that when setting the database connection in code for a crystal report you need to set the connection on every single table in the report Database Definition. You can do this like:
private static void SetConnectionInfo(ReportClass report, string ReportServer, string ReportDatabase)
{
TableLogOnInfo tInfo = new TableLogOnInfo();
ConnectionInfo connectionInfo = tInfo.ConnectionInfo;
connectionInfo.IntegratedSecurity = true;
connectionInfo.ServerName = ReportServer;
connectionInfo.DatabaseName = ReportDatabase;
foreach (Table t in report.Database.Tables)
{
t.ApplyLogOnInfo(tInfo);
}
foreach (ReportClass subReport in report.Subreports)
{
SetConnectionInfo(subReport, ReportServer, ReportDatabase);
}
}
John Hunter
2009-05-21 10:29:14