title: Cannot find file specified when dropping LocalDb database if .mdf was deleted
body: <p>I am trying to write an application that will create a local database if it's not found in the application's folder. I run this query after deleting the .mdf</p>
  
  <pre><code>IF EXISTS (SELECT * FROM sys.databases WHERE name = N'Test_db')
  BEGIN 
       DROP DATABASE Test_db 
  END
  
  CREATE DATABASE Test_db 
  ON PRIMARY (NAME=Test_db, FILENAME='...\Test_db.mdf')
  </code></pre>
  
  <p>My <code>command.ExecuteNonQuery()</code> throws an exception, even though it drops the database and creates a new one. The error comes from the <code>DROP DATABASE</code> part of the command.</p>
  
  <blockquote>
    <p>Additional information: Unable to open the physical file
    "...\Test_db.mdf". Operating system error 2: "2 (The system cannot
    find the file specified.)".</p>
    
    <p>File activation failure. The physical file name
    "...\Test_db_log.ldf" may be incorrect.</p>
  </blockquote>
  
  <p>I found <a href="https://stackoverflow.com/questions/34905318/sql-localdb-cannot-delete-a-db-when-its-files-are-deleted">this</a> question, but it has no solution to the problem.</p>