Specifying SQL Server port numbers in .NET

An interesting post from Chris Stewart about using a non-standard port for SQL Server and using .NET to talk to it.

.NET requires that you specify the port number with a comma, not the usual (and standard) colon.

Print | posted on Thursday, October 02, 2003 8:13 PM

Comments on this post

# re: Specifying SQL Server port numbers in .NET

Requesting Gravatar...
I was using the 'server=' syntax in my connection string which works for 1433. I couldn't get it to work with a different port.
I used a comma, colon, space, port=. Nothing worked.
I had to change it to use the 'data source=' syntax.

Abdu
Left by Abdu on Oct 03, 2003 3:07 PM

# re: Specifying SQL Server port numbers in .NET

Requesting Gravatar...
did you solve this problem, I would like to know the solution as I have a similar problem

My issue is that I can create an odbc connection to a server and I can ping as well

But I have a .NET web service which cannot find its database sql server, I think hardcoding the port number might help.

Arvind Ramaiya
Left by Arvind Ramaiya on Aug 26, 2004 12:23 AM

# re: Specifying SQL Server port numbers in .NET

Requesting Gravatar...
you should use SERVER=<Name of your server> and ADDRESS=<Name of your server>, port when trying to connect
Left by Ashivan on Jun 02, 2005 11:43 PM
Comments have been closed on this topic.