Tags

Sometime people would like to put mdf in APP_Data so they can zip the database with the code.

the connection string will look like

That’s fine for SQL Express installed but if you are running SQL 2005, you may get error to connect the database.
After a while try, I found you can see the mdf from Server Explorer -> Data Connections. Try to connect the server and have a look the property. you will see the connection string like

Data Source=.\SQLEXPRESS;AttachDbFilename=”C:\VS2008 Projects\Ajax2008\Ajax2008\App_Data\Northwind.mdf”;Integrated Security=True;User Instance=True

So after I added the User Instance=True, it works.

Advertisements