Antonio March

Antonio March

  • 2.1k
  • 3
  • 11.2k

Connecting to a mdf file

Sep 24 2010 3:20 PM
I downloaded an example of VB .NET program that opens a mdf file included in the same VB solution. The connectionstring is in the app.config file

I am using VB 2010 Express and SQL Server 2008 R2 (express, too, so free)

but it doesn't work for me.
the app.config is
<?xml version="1.0" encoding="utf-8" ?>
    <add name="default"
      connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Chinook.mdf;Integrated Security=True;User Instance=True"
      providerName="System.Data.SqlClient" />

and the error I get is

Failed to generate a user instance of SQL Server due to a failure in starting  the process for the user instance. The connection will be closed

and the code is

     Dim conn As SqlConnection
     conn = New SqlConnection(ConfigurationManager.ConnectionStrings("default").ToString())

I really don't know where to look at.


Answers (1)