Set Read-Only Access for Crystal Report in AlwaysOn environment

Viewed 619

I have two SQL servers that are being load balanced - AlwaysOn. Only the second one of these servers is supposed to be used for crystal reports. I would like to access the second SQL server using the readOnly flag in the connection string: ApplicationIntent=ReadOnly

In my C# class I am running the crystal reports based on 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);
}

I haven't found a way to set ApplicationIntent=ReadOnly though. Is this supposed to be done setting myConnectionInfo.Attributes? Unfortunately I haven't found an answer on this yet but unanswered questions:

2 Answers
Related