title: Database Connection Error "file in use"
body: <p>I am using Visual Studio 2010 C# Express and SQL Server Management Studio with SQL Server 2012
  I am getting an error when I try to connect a database to my Windows forms project. </p>
  
  <pre><code>"This file is in use.  Enter a new name or
  close the file that is open in another program"
  </code></pre>
  
  <p>I poked around online to try to find a solution but none worked.   So i decided to create a brand new database and a brand new project.  But I still get the error!</p>
  
  <p>here are the steps I use:   </p>
  
  <ul>
  <li>First I connected to my locally hosted server  </li>
  <li>then i right-clicked on <code>Databases</code> and selected <code>New Database</code> and named it <code>school</code>  </li>
  <li>then i right clicked the <code>tables</code> folder on my new database and selected <code>new table</code>  </li>
  <li>I added thes tables <code>student, course, enrolled</code> </li>
  <li>finally i threw some bogus entries into it</li>
  </ul>
  
  <p>Now I jump over to VS   </p>
  
  <ul>
  <li>I select <code>New Project</code> then <code>Windows Forms Application</code> and name it <code>Registrar</code>  </li>
  <li>then i click <code>add new data source</code>   </li>
  <li>select <code>database</code> in the <code>Choose a data source type</code> window  </li>
  <li>then i select <code>Dataset</code> in the <code>Choose a Database Model</code> window  </li>
  <li>then I click <code>New Connection</code>  I change the DataSource to <code>Microsoft SQL Server Database   File</code> browse to the DATA folder inside my 'SQLEXPRESS' folder and when i click the 'school.mdf' file i get the above error.</li>
  </ul>
  
  <p>any help would be greatly appreciated.</p>