Hi,
We wrote a Crystal Reports Viewer in C#. The viewer works very well if we use only tables in our reports. If we use Commands, we get a logon screen. Of course we don't want that.
We reset the the data source for each table, but it don't work apperently for Commands.
This is the code that I use to reset the data source:
What can be the problem?
We wrote a Crystal Reports Viewer in C#. The viewer works very well if we use only tables in our reports. If we use Commands, we get a logon screen. Of course we don't want that.
We reset the the data source for each table, but it don't work apperently for Commands.
This is the code that I use to reset the data source:
Code:
static private ReportDocument LoadReport(String reportLocation)
{
//ReportDocument document = new ReportDocument();
document.Load(reportLocation);
foreach (Table table in document.Database.Tables)
{
// Get the TableLogOnInfo object.
CrystalDecisions.Shared.TableLogOnInfo logonInfo = table.LogOnInfo;
// Set the server or ODBC data source name, database name,
// user ID, and password.
logonInfo.ConnectionInfo.ServerName = serverName;
logonInfo.ConnectionInfo.DatabaseName = databaseName;
logonInfo.ConnectionInfo.UserID = user;
logonInfo.ConnectionInfo.Password = password;
// Apply the connection information to the table.
table.ApplyLogOnInfo(logonInfo);
table.Location = table.Location;
}
}
What can be the problem?