Hi,

I have this app running fine on my pc with connecting to SQL server on my localhost using windows authentication. Now I am going to deploy it on my client's server where SQL Server 2K DB is on server "abcd" with SQL Server credientials (No windows authentication) My problem is when I changed my connection string to "Server=abcd;uid=username;pwd=password" in web.config and try to run the app I get following error,
Exception Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
:sad:
Can you help ?

tia,

tejashree.

Dani AI

Generated

A short, practical addon that clarifies the error and gives a safe checklist.

That error means SQL Server ended up expecting a “trusted” (Windows) login while your app tried to use SQL credentials — or the server is configured to accept only Windows logins. As discovered, leaving a Windows-auth flag in the deployed config will make the app attempt a trusted connection even when you supply a SQL username and password.

Quick checklist to fix and verify (do these on the SQL server and the web host machine):

  • Enable SQL logins on the server: in SQL Server Management Studio go to Server Properties → Security and enable mixed (SQL + Windows) authentication, then restart the SQL service.
  • Create a SQL login and map it to the target database (Security → Logins → New Login). Use a non-sa account with minimal required permissions.
  • Make sure the instance accepts remote connections: via SQL Server Configuration Manager enable TCP/IP for the instance (restart service), and start SQL Server Browser if it’s a named instance.
  • Open the database port on the firewall (default 1433) or use the instance’s configured port.
  • Ensure the deployed connection string actually uses SQL auth (no Windows/Trusted flags) and the app is reading the correct config entry.
  • Test from the web server machine with SSMS or sqlcmd to isolate network vs. app issues. Check the SQL error log for failed login messages.

Example connection-string patterns (replace names and credentials):

"Data Source=SERVERNAME;Initial Catalog=MyDatabase;User ID=SqlUser;Password=StrongPwd;"
"Data Source=SERVERNAME\INSTANCE;Initial Catalog=MyDatabase;User ID=SqlUser;Password=StrongPwd;"
"Data Source=SERVERNAME,1433;Initial Catalog=MyDatabase;User ID=SqlUser;Password=StrongPwd;"

Notes for and : implement authentication in the VB app using a users table, parameterized queries, and hashed+salted passwords; never use plaintext credentials and avoid the sa account. For , switch the server to mixed mode and create a SQL login as above.

Recommended Answers

All 5 Replies

Hi,

I have this app running fine on my pc with connecting to SQL server on my localhost using windows authentication. Now I am going to deploy it on my client's server where SQL Server 2K DB is on server "abcd" with SQL Server credientials (No windows authentication) My problem is when I changed my connection string to "Server=abcd;uid=username;pwd=password" in web.config and try to run the app I get following error,
Exception Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
:sad:
Can you help ?

tia,

tejashree.

Issue resolved. I'd forgotten to take 'Integrated Security=SSIP" from my web.config.

Dagnachew Minda

Guys i need help in vb application, am making an RSS News Ticker But i want this application to make user authentication from SQL Server to run, can anyone help me?

can you please send me your code I too want to connect SQL but in vain.
So please do hlp me...
Waiting for your quick reply......

Dagnachew Minda

i have same problem when i choose server authentication in sqlserver connection
what to do

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.