title: Visual Studio Connection String- Relative file path?
body: <p>I have built a database using visual studio 2010. In my dataaccess file i wrote my connection string</p>
  
  <pre><code>@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\USERNAME\Documents\Visual Studio 2010\Projects\SOFTWARE\Database\persondb.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
  </code></pre>
  
  <p>as you can see my database is in</p>
  
  <pre><code>C:\Users\USERNAME\Documents\Visual Studio 2010\Projects\Software\Database\persondb.mdf
  </code></pre>
  
  <p>My solution is </p>
  
  <pre><code>C:\Users\USERNAME\Documents\Visual Studio 2010\Projects\Software\Management System\Management System.sln
  </code></pre>
  
  <p>Connection String of a database has to be changed every time it transferred from one pc to another. I dont want to do that. So i tried to change the absolute file path to relative file path(regarding to my .sln file). I changed my connection string like this-</p>
  
  <pre><code>@"Data Source=.\SQLEXPRESS;AttachDbFilename=..\Database\persondb.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
  </code></pre>
  
  <p>but it didn't work. So what is my problem? windows usually recognizes  *..* as <em>directory up</em> command. Is relative file path dont work with connection strings?</p>