Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding SQL Login does not work

Tags:

sql-server

I'm receiving this error message in Visual Studio 2010:

Cannot open database \"Northwind\" requested by the login. The login failed.\r\nLogin failed for user 'Mike\Mike Simpson'

When I try to add the user, which is me. Then SQL server says

Msg 15063, Level 16, State 1, Line 1 The login already has an account under a different user name.

Here is my connection string:

"Data Source=Localhost;Initial Catalog=Northwind;Integrated Security=True"

I'm using SSMS not SQL Server express. I don't know what else I should do. This application used to work before I zipped it up.

like image 206
Jacob Pressures Avatar asked Oct 20 '25 01:10

Jacob Pressures


2 Answers

Had this problem and this is what solved it for me

sp_changedbowner 'sa'

Then just re-map your login DomainName\UserNameto the database (double click on the login->User Mapping->check your DB->check Datareader/Datawriter->Ok)


Picked it up from here http://www.sqlservercentral.com/Forums/Topic788865-146-1.aspx
hope this helps some one

like image 139
Sandra Patta Avatar answered Oct 22 '25 05:10

Sandra Patta


The answer to this problem was the connection string. I'm using a NAMED INSTANCE rather than a default instance. Thus my connection string needed to have two slashes and the named instance afterwards.

"Data Source=Localhost\Arius;Initial Catalog=Northwind;Integrated Security=True"

When i made this change everything worked. I hope this helps someone in the future.

like image 33
Jacob Pressures Avatar answered Oct 22 '25 04:10

Jacob Pressures



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!