Martin
Martin

Reputation: 24316

My database (.MDF) doesn't seem to attach to my .\SQLExpress but i can view it in VS 2010?

Can anyone help?

I created a DB under APP_Data using ADD ITEM and choosing SQL Server DB and sure enough its there. I can even double click it and it opens up in VS 2010 in the Server Explorer tab.

The connection that i have configured in my web.config is the following

<add name="ApplicationServices"
     connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|testDB.mdf;User Instance=true"
     providerName="System.Data.SqlClient" />

As you can see its using the .\SQLExpress. But if i open SQL Server Management and connect to .\SQLEXpress the database is NOT there.

Actually the reason i need to have access to the db is that i need to add membership info into it via aspnet_regsql.exe.

I also tried this via the aspnet_regsql.exe which pops up a gui and i enter the .\SQLExpress in the server name and i choose the db but the db is not there.

I am confused, why is it not attaching it? but VS 2010 can view it in the server explorer tab.

I created a blank aspx file and loaded it via IE and i presummed this would force the attaching of the db.

I must be doing something wrong?

Can anyone provide any info? I know it must be something stupid i am doing

thanks

Upvotes: 0

Views: 391

Answers (1)

BlackICE
BlackICE

Reputation: 8926

data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|testDB.mdf;User Instance=true

remove User Instance=true

and fyi italics don't work in code blocks :P

And connectionstrings.com is a great resource.

Here's another good link for SQL Express, although it's for 2005

Upvotes: 1

Related Questions