Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Change this part of your connection string</p> <pre><code>AttachDbFilename=|DataDirectory|\Store-Manager\storemanager.mdf </code></pre> <p>DataDirectory is a substitution string that could be controlled from your program using </p> <pre><code>AppDomain.CurrentDomain.SetData("DataDirectory", "....."); </code></pre> <p>This should be done before any data access code is called.<br> Of course on the target PC you should be sure to have the relative part of the path</p> <p>So let me give a practical example. </p> <p>You set your connection string with this </p> <pre><code>....;AttachDbFilename=|DataDirectory|\storemanager.mdf;.... </code></pre> <p>In the target PC, you deploy your database file in a subfolder called <code>Store-Manager</code> that you create as a subfolder of the <a href="http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx" rel="nofollow noreferrer">CommonApplicationData</a> folder<br> (on Win7 this is C:\programdata).<br> Then, inside your code, before any data access code, you write </p> <pre><code>string appPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(appPath, "Store-Manager"); </code></pre> <p>Of course, on the target PC the Microsoft Sql Server Express (or not) should be already installed. </p> <p>See this article on <a href="http://social.msdn.microsoft.com/forums/en-US/sqlce/thread/dc31ea59-5718-49b6-9f1f-7039da425296/" rel="nofollow noreferrer">Microsoft forums</a> or this question on <a href="https://stackoverflow.com/questions/1409358/ado-net-datadirectory-where-is-this-documented">this same site</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload