I'm learning to use ASP.NET and I came across the following problem: I could not access my database using SqlConnection()
because I got an error
Cannot open database "Sample" requested by the login. The login failed. Login failed for user 'Asus\Anne'
Code:
SqlConnection con = new SqlConnection("data source=(localdb)\\MSSQLLocalDB; Database=Sample;Integrated Security=True");
I looked into it and found out that maybe the problem was that the user didn't have permission to access the database.
I checked and I don't have indeed any user called 'Asus\Anne' under my database's users, but I do have a 'dbo' user (dbowner), which has the 'Asus\Anne' login.
So, I tried to change dbo's username to 'Asus\Anne' but it doesn't let me.
I also tried to add a new user to the database called 'Asus\Anne', with an 'Asus\Anne' login but I got an error saying the login is already taken (which makes sense).
I feel like I'm stuck. Any suggestion?
Thanks in advance!