connection string of ADO.Net of SQL Server
-
23-08-2019 - |
Question
I am confused about the connection string format of ADO.Net when connect to a non-default instance of SQL Cluster. I did search but find various samples, could anyone let me know what is the correct format please (if I know the virtual server name and instance name)? I am using trusted connection.
thanks in advance, George
Solution
ServerName\InstanceName ? Use double \ when handling strings in C#
OTHER TIPS
See http://www.connectionstrings.com/ - great site for making DB connection strings.
The following web site gives many different connection strings for you. The following should work I believe:
http://www.connectionstrings.com/sql-server-2005#1
This is also a duplicate of connection string to a SQL Server cluster
If you can connect to it using visual studio the connection properties should give you the connectionstring vs.net uses. Using that connectionstring might help.
If you want a quick & easy way to try different connection strings, I suggest DatabaseTester (disclaimer - I wrote it). It's free and a very easy way to test. And I agree with the other posts above, for figuring out connections strings ConnectionStrings.com is your best friend.