您可以創建一個ConnectionInfo對象,然後用ApplyLogOnInfo
下面是MSDN article on the ConnectionInfo Class
private void SetConnectionInfo (string table, string server, string database, string user, string password)
{
TableLogOnInfo logOnInfo = new TableLogOnInfo();
logOnInfo = Report.Database.Tables[table].LogOnInfo;
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo = logOnInfo.ConnectionInfo;
connectionInfo.DatabaseName = database;
connectionInfo.ServerName = server;
connectionInfo.Password = password;
connectionInfo.UserID = user;
Report.Database.Tables [table].ApplyLogOnInfo(logOnInfo);
}
樣品雖然通常我覺得它更容易只是使用它適用於每個報表上的表ORACLE的ODBC或TNS條目名稱,並在所有避免完全代碼的環境中保持相同的名稱。
考慮標記/提及語言和dbms – 2012-04-03 07:03:13