I have two SQL servers that balance the load - AlwaysOn. It is estimated that only the second of these servers will be used for crystal reporting. I would like to access the second SQL server using the readOnly flag in the connection string: ApplicationIntent=ReadOnly
In my C # class, I run 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 did not find a way to set ApplicationIntent=ReadOnly . Should this be done setting myConnectionInfo.Attributes ? Unfortunately, I did not find the answer to this question, but did not answer:
source share