title: WPF linq to sql connection issues
body: <p>I'm inexperienced with database use in general and I'm needing help with a couple of issues:</p>
  
  <p>In my WPF project I've set up a database to store email-like notifications like so:</p>
  
  <pre><code>public partial class AppDataContext : System.Data.Linq.DataContext
  </code></pre>
  
  <p>And then:</p>
  
  <pre><code>    public partial class AppDataContext {
  
      public static AppDataContext OpenDatabase() {
  
      string fileName = @"C:\ProgramData\DSI\AppData.mdf;";
  
          AppDataContext dataContext = new AppDataContext (fileName);
  
          if (!dataContext.DatabaseExists())
              dataContext.CreateDatabase();
  
          return dataContext;
      }
  }
  </code></pre>
  
  <p>Now after using it I'm getting the following message on OpenDatabase():</p>
  
  <blockquote>
    <p>A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)</p>
  </blockquote>
  
  <p><strong>Q:What would cause this?</strong></p>
  
  <p>Also I noted that I can't just delete the .mdf and .ldf file to start over with a clean database - the db seems to be registered somewhere else. (I put the .mdf and .ldf file back where they were.)</p>
  
  <p>What I think I need is a solution where the database file is kept locally and can be deleted using file explorer and just recreated with <code>CreateDatabase()</code> the next time the function is called.</p>
  
  <p><strong>Q:Does that exist as a solution for a WPF desktop app?</strong></p>