title: System.Data.Entity.Core.EntityException' occurred in EntityFramework.SqlServer.dll but was not handled in user code
body: <p>I am using Visual studio 2012 MVC 4 connecting to the database SQL SERVER Management Studio 2012.</p>
  
  <p>I am getting below exception </p>
  
  <blockquote>
    <p>System.Data.Entity.Core.EntityException occurred in EntityFramework.SqlServer.dll but was not handled in user code
    Additional information: The underlying provider failed on Open.</p>
  </blockquote>
  
  <pre><code>public Actionresult Details(int id) {EmployeeContext employeeContext = new EmployeeContext();
  Employee employee = employeeContext.Employees.Single(x =&gt; x.EmployeeId == id); return View(employee);}
  </code></pre>
  
  <p>Also sometimes i get following exception while using connection string </p>
  
  <pre><code> &lt;connectionStrings&gt; &lt;add name="EmployeeContext" connectionString="server=.; database=Sample; integrated security=SSPI"
      providerName="System.Data.SqlClient"/&gt;
  </code></pre>
  
  <p></p>
  
  <blockquote>
    <p>System.Data.SqlClient.SqlException : Cannot open database "Sample" requested by the login. The login failed.
    Login failed for user 'NT AUTHORITY\SYSTEM'.</p>
  </blockquote>