title: "Cannot open user default database. Login failed." after installing SQL Server Management Studio Express
body: <p>I have a database in a local file that is used by a program.  The program has limited functionality and I needed to run some quick queries.  I installed SQL Server Management Studio Express 2005 (SSMSE), connected to the SQL Server instance, attached the database file, and ran the queries.  Now the original program will no longer connect to the database.  I receive the error:</p>
  
  <blockquote>
    <p>Cannot open user default database. Login failed. Login failed for user 'MyComputer\MyUserName'.</p>
  </blockquote>
  
  <p>I've gone back into SSMSE and tried to set the default database.  I've opened up <strong>Security, Logins, BUILTIN\Administrators</strong> and <strong>BUILTIN\Users</strong>.  Under <strong>General</strong>, I have set the default database to the program's database.  Under <strong>User Mappings</strong>, I made sure the database is ticked and that <strong>db_datareader</strong> and <strong>db_datawriter</strong> are ticked.</p>
  
  <p>The program uses the connection string:</p>
  
  <blockquote>
    <p>Server=(local)\Instance; AttachDbFilename=C:\PathToDatabase\Database.mdf; Integrated Security=True; User Instance=True;</p>
  </blockquote>
  
  <p>I know jack-all about database administration.  What else am I missing?</p>