且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法编辑ODBC连接

更新时间:2023-02-23 10:10:04

reportDoc.Load(report);

ConnectionInfo connInfo = new ConnectionInfo();
connInfo.ServerName = "Driver={SQL Native Client};Server=SQLServer;";
connInfo.DatabaseName = "myDatabase";
connInfo.UserID = "myUser";
connInfo.Password = "myPassword";

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 = "mySchema." + table.Location;
}



以上代码摘自以下文章:

http://***.com/Questions/674363/how-do-i-change-a-crystal-reports-odbc-database-connection-at-runtime [



Above Code is adopted from below article:

http://***.com/questions/674363/how-do-i-change-a-crystal-reports-odbc-database-connection-at-runtime[^]