views:

21

answers:

1

Hi there,

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

+1  A: 
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

David
Thank you david! Thanks for the confirmation
Martin