0

I know there are several questions in regards to this already, but I have not found one that seemed to help.

I have tested the connection string in SQL Server Object Explorer and was able to connect to it successfully so I am not sure there is anything wrong with the string.

Please note that for privacy/security the string has been slightly modified but still follows the format of the real string.

After it hits Connection.Open(); it throws the SQL 40 error.

connection = new SqlConnection("Server=prod.domain.com,port#;database=dbname;UID=user;PWD=pw;Trusted_Connection=No;");
connection.Open();
6
  • 1
    shouldn't it be Initial Catalog instead of 'database' Commented Oct 1, 2018 at 18:53
  • @Silvermind LOOOL it likely should.... thanks.... Debugging a DLL from 2003 is a headache to begin with... Commented Oct 1, 2018 at 18:53
  • 1
    That's a valid connection string. Many of the parameters have aliases. See learn.microsoft.com/en-us/dotnet/api/… Commented Oct 1, 2018 at 18:56
  • @DavidBrowne-Microsoft would you have any ideas as to why it breaks on open? Commented Oct 1, 2018 at 19:01
  • Just all the normal reasons. Wrong hostname, wrong IP, wrong port, Windows Firewall, network firewall, etc. Commented Oct 1, 2018 at 19:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.