I just installed [sql server express r2].I connect to my database from asp.net project with this connection string:
"Data Source= my-PC\SQLEXPRESS;Integrated Security=true;Database=example"
The life was beutifull untill I added to project new database created in [Managment Studio] (example2).Suddenly I got this eror:
Cannot open database “example” requested by the login. The login failed.
Login failed for user ‘my-PC\love’.
After that I couldn’t connect either [example] and [example2].Then I tryed to use ‘sa’ login:
"Data Source= my-PC\SQLEXPRESS;Database=example;User ID=my;Password=password"
No effect.
I read a lot of articles.I tryed to use all I can :I enable all [protocol names],disable firewall,use mixed mode but still not resolved problem.
Any idea?
Edit:
I can login to managment studio using “my” login and password.But from project in visual studio cant.
For your second connection string: remove the “integrated security” section.
However, using the SA login for anything, especially in your software is a really bad practice.
The error you are getting in your first example indicates that the login does not have access to the new database. Pull up the login’s properties in SSMS (under Security -> Logins) and add the database on the “User Mapping” page.