SQL Server does not exist or access denied

Today I spent more than 1 hour troubleshooting a stupid problem

I was trying to connect to SQL 2005 from a normal System.Data.SqlClient.SqlConnection but I always get the error:
System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.

Using the same code on other SQL Server 2000/2005 it works properly and SQL Management Studio is able to connect to that server.

What was the problem ??
Very easy, it was a named instances (I got it using SELECT @@SERVERNAME;) and MS Article ID 888228 explained cause and resolution.

During SQL Express setup, always check if you're going to install a Default Instance or a Named Instance !!!!

See also MS Article ID 328306 for other potential causes of this error message.
Share on Google Plus

About Vittorio Pavesi

    Blogger Comment
    Facebook Comment

0 commenti: