title: Connect LocalDB to ASP.net Project
body: <p>I have as ASP.net project with localDB in it.
  The database file name is ProjectDB.sdf and I placed him in the App_Data folder.</p>
  
  <p>My connection string is: </p>
  
  <pre><code>&lt;add name="ProjectConnection" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ProjectDB.sdf;Integrated Security=True" providerName="System.Data.SqlClient"/&gt;
  </code></pre>
  
  <p>I try to use the database in my cs file like this:</p>
  
  <pre><code>conn.ConnectionString = ConfigurationManager.ConnectionStrings["ProjectConnection"].ConnectionString;
  using(SqlCommand cmd = new SqlCommand())
  {
      cmd.CommandText = "select JobTitleId, JobTitleText from LuJobTitle where JobTitleText like @SearchText + '%'";
      cmd.Parameters.AddWithValue("@SearchText", prefix);
      cmd.Connection = conn;
      conn.Open();
  </code></pre>
  
  <p>The application falls in the conn.Open(); command.</p>
  
  <p>The error message I get says:</p>
  
  <pre><code>An attempt to attach an auto-named database for file d:\user\documents\visual studio 2012\Projects\RealMatchSite\RealMatchSite\App_Data\ProjectDB.sdf failed.
  A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Thank you in advance!</p>