[英]Crystal Report ask database parameter Login C#
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? 您好,我有一个关于C#程序的问题,我必须在C#软件中使用Crystal报表进行打印,我的问题是,当我进行打印时,Crystal报表询问数据库登录参数时,如何禁用此功能? thank you 谢谢
Below I put the picture of the code and error 下面我把图片的代码和错误
Code and Error: 代码和错误:
Errore 2 method: 错误2方法:
Use SetDatabaseLogon function 使用SetDatabaseLogon函数
Myreport.SetDatabaseLogon("username", "password", "server", "dbname", false);
If SetDatabaseLogon function not working ...manually assign connection details to each table in the reports 如果SetDatabaseLogon函数不起作用...手动将连接详细信息分配给报告中的每个表
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;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.