How do you specify the port number in a oledb connection string to SQL server 2005?
-
02-07-2019 - |
Question
Just found this out, so i am answering my own question :)
Use a comma where you would normally use a colon. This can be a problem for named instances, as you seem to need to specify the port even if it is the default port 1433.
Example:
Provider=SQLOLEDB;Data Source=192.168.200.123,1433; Initial Catalog=Northwind; User Id=WebUser; Password=windy"
Solution
I always check out http://www.connectionstrings.com/. It is a brilliant resource for connection strings.
OTHER TIPS
Good call BlackWasp, actually that is where i found the answer! (But it was somewhat buried, so i wrote this one which is hopefully clearer)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow