I try to execute this web application but it gave me this error messages when I try to register a user account in the web application:
System.Data.SqlClient.SqlException occurred
HResult=0x80131904
Message=Cannot open database "rentalsystem" requested by the login. The login failed.
Login failed for user 'MicrosoftAccount\corene100@outlook.com'.
Source=.Net SqlClient Data Provider
I look up online and try any of the solutions stated but still this error pops up every time I try to click the register button. I already created a user login for MicrosoftAccount\corene100@outlook.com
(using Windows authentication) in Microsoft SQL Server Management Studio and confirm that it has db_owner
permissions to the database.
However, if I try to create the login for SQL Server Authentication, the login name is not available because of the special character existed. I have connect a lot of other database before but none of this error pops up ever.
Is there any way to let the Visual Studio 2017 connect to database using my original user login credentials? Which is DESKTOP-2UB7OKA\Corene
. I have tried to change the connection string to this too:
Data Source=DESKTOP-2UB7OKA;Initial Catalog=rentalsystem;
Integrated Security=True;Pooling=False;User ID=MicrosoftAccount\corene100@outlook.com
or
Data Source=DESKTOP-2UB7OKA;Initial Catalog=rentalsystem;
Integrated Security=True;Pooling=False;User ID=DESKTOP-2UB7OKA\Corene
None of those works. And the second one still make it login to database using the MicrosoftAccount\corene100@outlook.com
username.
What is the problem here? I have confirm both user have the db_owner permission to the database and I have enabled the Windows Authentication on the web application properties. I have no idea what's next I have to do.
Please help, thanks.
In your Visual Studio go to "SQL Server Object Explorer". (if you don't see it go to View in the menu bar and click on SQL Server Object Explorer), you need select your database, right click and then click on Detach.
hope this will help. Thanks
I had this problem and what solved it for me was to: