Following code working perfectly and showing perfect result of crystal report but when i click on sub report it ask me for crystal report login authentication:
TableLogOnInfo logonInfo = new TableLogOnInfo();
// Set the logon information for each table.
foreach (Table table in report.Database.Tables)
{
// Get the TableLogOnInfo object.
logonInfo = table.LogOnInfo;
// Set the server or ODBC data source name, database name,
// user ID, and password.
logonInfo.ConnectionInfo.ServerName = reportServerName;
logonInfo.ConnectionInfo.DatabaseName = reportDb;
logonInfo.ConnectionInfo.UserID = reportUserId;
logonInfo.ConnectionInfo.Password = reportPassword;
logonInfo.ConnectionInfo.IntegratedSecurity = reportIntegratedSecurity;
// Apply the connection information to the table.
table.ApplyLogOnInfo(logonInfo);
}
above code only binding Connection Info to main report how can i bind Connection Info of subReport? I tried this code but it does not work:
TableLogOnInfo logonInfo2 = new TableLogOnInfo();
foreach (Table table in report.Subreports[0].Database.Tables)
{
// Get the TableLogOnInfo object.
logonInfo2 = table.LogOnInfo;
// Set the server or ODBC data source name, database name,
// user ID, and password.
logonInfo2.ConnectionInfo.ServerName = reportServerName;
logonInfo2.ConnectionInfo.DatabaseName = reportDb;
logonInfo2.ConnectionInfo.UserID = reportUserId;
logonInfo2.ConnectionInfo.Password = reportPassword;
logonInfo2.ConnectionInfo.IntegratedSecurity = reportIntegratedSecurity;
// Apply the connection information to the table.
table.ApplyLogOnInfo(logonInfo2);
}