C# "The underlying provider failed on Open."

2.3k views Asked by At

The InnerException says: "Cannot open database \"test\" requested by the login. The login failed.\r\nLogin failed for user 'XYZ\ABC'."

So I am using visual studio 2013 and connecting to SQL 2014. The database was working before, but then I had a little bit issues with my tables, so I decided to delete the entire database, and let Entity Framework to automatically create a new one for me. When I am deleting, it does not allow me to delete without check the box says "stop all connection". I think this might be the issue.

After that, when I am trying to run the application again, this issue keeps coming back.

My SQL management Studio has the correct "XYZ\ABC" as a log-in. My SQL management Studio has the correct "XYZ\ABC" as a log-in.

So here's my connection string in Web.config:

<connectionStrings>
    <add name="test"
    connectionString="Data Source=.\sqlexpress;Initial Catalog=test;Integrated Security=true"
    providerName="System.Data.SqlClient"/>
  </connectionStrings>

Any help or advice that I can try to re-establish the connection? Thank you in advance!

0

There are 0 answers