Tutorial :Cannot Connect to Sql Server Enterprise On Local Machine


I have SQL Server 2008 Enterprise edition, and C# code that should connect to said server. It's a local server on my computer and when I try to log on I get this error:

Cannot open database "Clients" requested by the login, the login failed.
Login failed for user crmsys.

This user has the right permissions, this server is even configured to allow remote connections and through the management studio I can access as this user.

Here's my connection string:

Data Source=./; Initial Catalog=Clients;user ID=crmsys;Password= Password;  


In your snippet of configuration settings in your initial post there is a space between the equals sign and the first character of the password - is this correct?


i'm not sure "./" is a valid datasource. I always use "localhost" or ". \ [instancename]"

just an idea.


Make sure you dont have a firewall blocking you; the windows one does by default... If thats all ok check remote connections are enabled: From management studio Check Properties, Connections, and check "Allow Remote Connections To This Server" is checked.

If that is checked then restart SQL Server and try again; if it still fails check that TCP/IP is enabled and the settings using the Configuration Manager.


Are you sure the crmsys user has permission to connect to the database?

If you right-click the "Clients" database entry in SSMS, then go to "Properties" -> "Permissions", then select the "crmsys" user from the "Users or roles" pane, and then click the "Effective" tab, can you confirm that the "CONNECT" permission is there?

Edit: it should look like the image below:

alt text http://img42.imageshack.us/img42/4696/ssms.png


Have you tried Server=.\sqlexpress;Database=Clients;Uid=crmsys;Password=Password;Integrated Security=false


Solved it!!!!!! that was very weird but guess it turned out to be a conflict in the db properties, it's mixed out with the previues user which was crmsys(on the first computer) and when i restored it into my computer i made allready a user name crmsys - delete the user from the DB, deleted the Login crmsys, restored it and then opened a new user with the same permissions, and that it! Thanks you all for helping me figuring it out!

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »