What is the C# code to get the sql server name?
Posted on 2005-04-09
I am just learning C# and sql and wonder what I need to do to find out where the server is so I don't have to hard code it in the connection string.
The tutorial connection string starts like this:
string ConStr =@"server=(local)\NetSDK;" + ...
Obviously, not everybody is going to have his server at (local)\NetSDK.
How do I check for the server location to dynamically build my connection string?
Complete lines of code wanted.