title: Installing .NET application with database
body: <p>finally, with the help of Stackoverflow, i managed to finished my project.</p>
  
  <p>the last problem that i encountered is during installation. </p>
  
  <p>i created my installer using installshield limited edition.</p>
  
  <p>the installer includes .net 2.0 sp2, .net 4.0, windows installer 4.5, and sql server 2008 express.</p>
  
  <p>inside the files, i included the database file, which is .MDF (i.e. ThesisDB.mdf)</p>
  
  <p>by default, it will be installed in C:\Program Files</p>
  
  <p>after installation, the current location of the database is: </p>
  
  <p>C:\ProgramFiles\HealthAndFitnessAppTest\My Product Name\</p>
  
  <p>here is the trick that i did with my connection string, my connection string is, </p>
  
  <p>Dim CN As New SqlConnection
  ("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\ProgramFiles\HealthAndFitnessAppTest\My Product Name\ThesisDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")</p>
  
  <p>but an error appears...</p>
  
  <p>"an attempt to attach an auto-named database failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."</p>
  
  <p>unfortunately, the trick didnt worked. sorry guys, can you please give me an idea on how will i properly deploy my application together with its database?</p>