I am using a System.Data.SqlClient.SqlConnection to connect to a SQL
Server 2005 database. I instantiate the SqlConnection with a
connection string...
SqlConnection sqlConn = new SqlConnection(@"Network
Library=DBMSSOCN;Data Source=(local)" +
",1433;Database=CATHYDB;User
id=cathy;Password=pswd;");
When this code runs I can guarantee that everything about it will be
constant, except the port (here I've coded it as 1433).
I want to avoid hard-coding the port number. So, how can I either
a) find out which port SQL Server 2005 is using, or
b) use a different approach which doesn't require a hard-coded port
number?
Many thanks,
Cathy