0

I have the following connection string in my web.config

<add name="xxx" 
connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=xxx;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\xxx.mdf" 
providerName="System.Data.SqlClient" />

I have now moved my mdf file from:

C:\K\ST18 Mar 4\WebUx\App_Data\xxx.mdf

to:

C:\K\ST18 Mar 4\xxx.Data.Store\App_Data\xxx.mdf

I tried to put that into the web.config but it will not accept the "C:\" etc.

How can I change my web config so the AttachDBFilename is correct. Note that xxx.Data.Store is a sister project within the same solution so I want to make my path go up one directory and then down into xxx.Data.Store\App_Data

  • Hi, check the answers on this post (Not the accepted answer but the fourth answer with 3 upvotes) http://stackoverflow.com/questions/3500829/sql-express-connection-string-relative-to-application-location it tells you how to specify a relative path to your file ;o) – Luke Baughan Mar 06 '13 at 10:24
  • @bUKaneer - On every post there is a `share` link which gives you permalink for that post. You can better share that link, because order of the post depends on sorting order and votes can vary on time. – NaveenBhat Mar 06 '13 at 12:14
  • @NaveenBhat ahhh brilliant idea - cheers for the tip, very much obliged! – Luke Baughan Mar 06 '13 at 12:19

0 Answers0