Hello I have a question about C# program, I have to make prints with Crystal reports in a C # Software my problem is that when I make printing Crystal reports asks the database login parameters, how can I disable this? thank you
Below I put the picture of the code and error
Code and Error:
Errore 2 method:
Use SetDatabaseLogon function
Myreport.SetDatabaseLogon("username", "password", "server", "dbname", false);
If SetDatabaseLogon function not working ...manually assign connection details to each table in the reports
ConnectionInfo connInfo = new ConnectionInfo();
connInfo.ServerName = "Driver={Adaptive Server Enterprise};Server=x.x.x.x;Port=x;";
connInfo.UserID = "username";
connInfo.Password = "password";
TableLogOnInfo tableLogOnInfo = new TableLogOnInfo();
tableLogOnInfo.ConnectionInfo = connInfo;
foreach(Table table in reportDoc.Database.Tables)
{
table.ApplyLogOnInfo(tableLogOnInfo);
table.LogOnInfo.ConnectionInfo.ServerName = connInfo.ServerName;
table.LogOnInfo.ConnectionInfo.DatabaseName = connInfo.DatabaseName;
table.LogOnInfo.ConnectionInfo.UserID = connInfo.UserID;
table.LogOnInfo.ConnectionInfo.Password = connInfo.Password;
// Apply the schema name to the table's location
table.Location = "dbo." + table.Location;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.