views:

169

answers:

6

Hi all, i've sql server 2008 enterprise edition, and a c# windows form code that should connect to 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 faild for user crmsys.

now, this user have the right permissions, this server even configured to allow remote connections and through the management studio i can access with this user. my connection string is:

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

Thank you all. Amit.

A: 

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.

u07ch
well it's not the firewall cause firewall will not close doors for local connections, it's just one computer running both
Mazki516
+2  A: 

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?

Jeremy McGee
well that a great idea but it's nothing to do with that, when it's a wrong password it's says "login failed for user crmsys" but thatnks!
Mazki516
+2  A: 

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

just an idea.

j.a.estevan
I was thinking the same thing. I use either localhost or just the period.
Wade73
It is, I just wrote a quick test app with that as the data source and it connects fine.
Jared Russell
just a period ".", or "(local)" will do as well
marc_s
A: 

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

Jared Russell
:( yes, it has tons of permissions, i don't think it's permissions
Mazki516
A: 

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

EEE
no. the connections string is fine, tried already tons of variations..but thanks
Mazki516
A: 

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!

Mazki516