我有兩個負載均衡的SQL服務器 - AlwaysOn。只有這些服務器中的第二個應該用於水晶報告。我想用readOnly
標誌在連接字符串中訪問第二個SQL服務器:ApplicationIntent=ReadOnly
在AlwaysOn環境中設置Crystal Report的只讀訪問權限
在我的C#類我基於ConnectionInfo()
var myConnectionInfo = new ConnectionInfo();
Tables myTables = reportDocument.Database.Tables;
for (int i = 0; i < myTables.Count; i++)
{
var myTable = myTables[i];
var myTableLogonInfo = myTable.LogOnInfo;
myConnectionInfo.ServerName = 'serverName';
myConnectionInfo.DatabaseName = 'databaseName';
myConnectionInfo.UserID = 'userId';
myConnectionInfo.Password = 'password';
myTableLogonInfo.ConnectionInfo = myConnectionInfo;
myTable.ApplyLogOnInfo(myTableLogonInfo);
}
運行水晶報表我還沒有找到一種方法儘管設置爲ApplicationIntent=ReadOnly
。這應該是設置myConnectionInfo.Attributes
?不幸的是我還沒有發現這個還沒有,但懸而未決的問題的答案:
- https://archive.sap.com/discussions/thread/3861287
- https://archive.sap.com/discussions/thread/3791155
將'userID'的權限設置爲只讀在數據庫服務器上怎麼辦? – dd4711