Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen deploying a Winfoms app that uses SQL Server user instance, where should I put the MDF,LDF files?
    primarykey
    data
    text
    <p>I have a C# app written using Entity Framework 4.3.1.0 that talks to a SQL Server 2008 user instance on my development machine in Visual Studio 2010. It also works on my laptop in Visual Studio. But on the customers desktop PC, with SQL Server 2008 R2 I can't connect to the database with the application. The error is </p> <blockquote> <p><em>The underlying provider failed on Open</em></p> </blockquote> <p>All three computers are Windows 7 64-bit, but the app is 32 bit.</p> <p>I suspected the connection string in <code>myapp.exe.config</code>, but it is the same as the one I use in Visual Studio.</p> <p>In doing the research I have come up with two possibilities.</p> <ol> <li>Does the same connection string work with SQL Server 2008 and SQL Server 2008 R2?</li> <li>Does the location of the <code>.mdf / .ldf</code> files matter, I initially installed them in the application folder, but there may be a better place, like a predefinded <code>AllUsersAppData</code>. Is the application folder read-only for the server files?</li> </ol> <p>Here is the ConnectionStrings section from app.config. I don't know if both are required.</p> <pre><code> &lt;connectionStrings&gt; &lt;add name="DataClass.Properties.Settings.SWDatabaseEntities" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\SWDatabase.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /&gt; &lt;add name="SWDatabaseEntities" connectionString="metadata=res://*/SWDatabaseModel.csdl|res://*/SWDatabaseModel.ssdl|res://*/SWDatabaseModel.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\SWDatabase.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework&amp;quot;" providerName="System.Data.EntityClient" /&gt; &lt;/connectionStrings&gt; </code></pre> <p>It started working for some reason after I removed an errant from mcahine.config that an IBM Client had installed. It didn't work right away, but I don't know what else changed. Maybe it was after a reboot.</p>
    singulars
    1. This table or related slice is empty.
    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. 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