0

I am using Connection string in my web.config. I have given user id, password, data source etc in the connection string. When i tried to connect to the SQL server using "Connection.Open()" I am getting an exception stating The user is not authorized. The user name that is mentioned is my windows user name(yes my windows user name and not the one mentioned in connection string). I am not sure why and how this is happening. I tried several times and the same thing is happening.

Filburt
  • 17,626
  • 12
  • 64
  • 115
  • 4
    You'd have to show your connection string - (though you can mangle the user/PW info) – Reed Copsey Feb 27 '14 at 18:50
  • 1
    Are you using window authentication or SQL authentication to login to sql server? – Shantanu Gupta Feb 27 '14 at 18:52
  • 2
    Try testing your connection by [using the Data Link Wizard](http://stackoverflow.com/a/10480011/205233) and compare the generated connection string against the one you use in your we.config. – Filburt Feb 27 '14 at 19:01
  • @Filburt is right. Data Link Wizard is always my first step in troubleshooting a DB connection string. – TimG Feb 27 '14 at 20:04

1 Answers1

0

If you believe that VB.NET is part of the problem, try using the same connection parameters from the same client, but with different client software. For example try connecting from Access or SQL Server Management Studio or Excel. This will help you narrow down whether your problem is with the security configuration versus the code or client software. Often times if you try to connect from a remote workstation you can end up with a failure against a server that has not been configured to allow remote connections.

BlueMonkMN
  • 25,079
  • 9
  • 80
  • 146