Damian Maclennan Blog

Damian's Datalog

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.

Legacy Comments


Abdu
2003-10-03
re: Specifying SQL Server port numbers in .NET
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

Arvind Ramaiya
2004-08-26
re: Specifying SQL Server port numbers in .NET
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

Ashivan
2005-06-02
re: Specifying SQL Server port numbers in .NET
you should use SERVER=<Name of your server> and ADDRESS=<Name of your server>, port when trying to connect