Well, you would need to add MicrosoftAccount\MyEmail as a user in the database StockSytsemDb.
It could have helped if you had included what troubleshooting you have performed, and some information why you don't expect to get this error.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
System.Data.SqlClient.SqlException: 'Cannot open database "StockSystemdb." requested by the login. The login failed.
Login failed for user 'MicrosoftAccount\MyEmail'.'
Any fix?
Well, you would need to add MicrosoftAccount\MyEmail as a user in the database StockSytsemDb.
It could have helped if you had included what troubleshooting you have performed, and some information why you don't expect to get this error.
Hi uzairakhalwaya-2700,
Welcome to Microsoft Q&A.
Could you please try to use user 'MicrosoftAccount\MyEmail' to connect to SQL Server database and see if there are any detailed error message?
And what the connection string are you using?
Please make sure user 'MicrosoftAccount\MyEmail' exists under database->security->users.
Best Regards,
Amelia
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.