Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, <em>|DataDirectory|</em> Web application to select the App_Data directory of the web application.</p> <p>In a not web application, depending on .NET Framework, it could be used and also changed using <em>AppDomain.SetData</em></p> <p>But you have other two posiblities to create the connection:</p> <p><strong>1.- Use a relative path:</strong></p> <pre><code>String con ="... AttachDbFilename=Databases\MyUnitTestDB.mdf ... "; </code></pre> <p><strong>2.- get the application path and add to the String</strong>.<br> In c# Windows Application you can use Application.StartupPath</p> <pre><code> String con= " ... AttachDbFilename=" + Application.StartupPath + "\Databases\MyUnitTestDB.mdf ... "; </code></pre> <p>Depending on the applicaiton type or launch mode you got different properties. Ex:</p> <ul> <li><strong>Application.StartupPath</strong> -- The start path of the exe application that starts the application</li> <li><p><strong>Application.ExecutablePath</strong> -- the start path an name of the exe application that stats the application But to use Application you need to include System.Windows.Forms that is not included for example into console applications.</p></li> <li><p><strong>System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase</strong>) -- This gets the path from the current assembly "dll,exe,..." Is not affected by application type, path changes,... Always return the directory when the Assemby resides.</p></li> <li><p><strong>Environment.CurrentDirectory</strong> -- the current directory. This can be changed for example if you navigate into folders.</p></li> </ul> <p>You can find more about the different connection string options here <a href="http://www.connectionstrings.com/sql-server-2005" rel="nofollow noreferrer">http://www.connectionstrings.com/sql-server-2005</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.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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