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. In that logon screen it is impossible to enter the Server and the Database because this fields are disabled. It is possible to enter a username and password. When I click OK, I'm in an iteration of that logon screen. Of course I don't want that logon window, because all logon parameters are in the XML file.
In our Crystal Viewer, we try to reset the the data source (using the parameters in the XML-file) for each table, but it don't work apperently for Commands. (It works for tables, not for commands)
This is the code that I use to reset the data source:
In our Crystal Viewer, we try to reset the the data source (using the parameters in the XML-file) for each table, but it don't work apperently for Commands. (It works for tables, not 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;
}
}