Why are you using AttachDbFileName
and User Instance
? Attach the database to your instance correctly, then use:
Data Source=.\SQLEXPRESS;Initial Catalog=ASPNETDB;Integrated Security=True;
...or (since I don't know whether you are actively using two instances intentionally)...
Data Source=Laptop;Initial Catalog=ASPNETDB;Integrated Security=True;
EDIT
You need to connect to the .\SQLEXPRESS
or the Laptop
instance (you need to pick one to use!) and attach one or both databases to that instance. You can do this using CREATE DATABASE ... FOR ATTACH
. I suggest doing this with the free Management Studio Express (or the 2012 version) if you don't already have a full-blown version of Management Studio. I can't imagine how many different ways you could try to do this from Visual Web Developer. Your syntax in a new query window might look something like this:
CREATE DATABASE ASPNETDB
ON (FILENAME = 'C:\...path...\ASPNETDB.MDF')
FOR ATTACH;
If it has trouble doing this without the log file, you can try this slightly different version:
CREATE DATABASE ASPNETDB
ON (FILENAME = 'C:\...path...\ASPNETDB.MDF')
FOR ATTACH_REBUILD_LOG;
(Of course you first need to move your MDF file(s) to the appropriate location - they shouldn't be under C:\Users\...
)
Now don't open up those databases again directly in Visual Web Developer... they're part of your local instance.