title: C# Windows Form Application with Database not running on Client's System
body: <p>I have developed a Windows Form Application in C# that uses SQL Server database connectivity. I developed it in .NET Framework 4.0 and SQL Server 2008 R2. My application is using a local database present in the root directory of the application called <code>AG.mdf</code>. </p>
  
  <p>This is my connection string:</p>
  
  <pre><code>Data Source=.;AttachDbFilename=|DataDirectory|\\AG.mdf;Integrated     Security=True;User Instance=True 
  </code></pre>
  
  <p>I created the installer by adding Setup Project inside Visual Studio installer template as a new project in my application. I build the Setup project and it created the installer for me. I deployed the application on my User's system, the application starts initially but then it suddenly pops up an error</p>
  
  <blockquote>
    <p>Unhandled exception has occurred in your application. If you click continue, the application will ignore this message and attempt to continue. If you click quit, the application will close immediately.</p>
    
    <p>A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)</p>
  </blockquote>
  
  <p><strong>P.S: I have installed .NET Framework 4.0 and SQL Server Compact Edition on my User's system as well!</strong></p>
  
  <p>Should I quit programming :'(</p>