-1

error is network related or instance specific error occurred while establishing a connection with SQL Server. The Server was not found or was not accessible. Verify that the instance name is correct and SQL Server is configured to allow remote connections.

my server name is : laptop

my connection string is: Data Source=Laptop;Initial Catalog=itassetmgt;Integrated Security=True

ASPNETDB.MDF file's data source is:Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Users\Kamesh Biniwale\Documents\Visual Studio 2010\WebSites\login\App_Data\ASPNETDB.MDF";Integrated Security=True;User Instance=True

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490

1 Answers1

0

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.

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
  • my original database file is itassetmgt in which all my project tables n everything is made.Is there any issue with my Computer name "Laptop" or the Server name that it dont allow me to access the ASPNETDB ?? How can i change my Data Source string to .\SQLEXPRESS ?? – Kamesh Biniwale Mar 13 '12 at 08:05
  • yes i have installed SQL Server Management Studio 2008 R2... the version is as follows of it.. Microsoft SQL Server Management Studio- 10.50.1600.1 Microsoft Data Access Components (MDAC)-6.1.7601.17514 Microsoft MSXML- 3.0 4.0 5.0 6.0 Microsoft Internet Explorer- 9.0.8112.16421 Microsoft .NET Framework- 2.0.50727.5448 Operating System- 6.1.7601 – Kamesh Biniwale Mar 13 '12 at 17:42
  • Why do you think closing a connection shuts down the server? When you turn your car off, the car is still there. – Aaron Bertrand Mar 14 '12 at 19:43
  • is it one and the same thing... opening the database frm the SQL Server Management Studio 2008 R2 & frm the inbuilt Database Explorer of Visual Web Developer Express 2010 ??? – Kamesh Biniwale Mar 14 '12 at 19:47
  • Yes, so why do you think disconnecting from the database (in Management Studio or in Visual Studio) should shut your server down? When you turn your TV off, do you think the cable company shuts down their operation for the night? – Aaron Bertrand Mar 14 '12 at 19:50
  • vry true Aaron... now the concept is getting clear for me.. m soo messed up rit now. its really new for me working in VWD 2010 with SQL Server 2008 but here i have some projects for guidance were they have a folder App_Data in which the database file is saved with the extension .MDF in my website build i hv tht folder but the database file is not build thr. y so ? i jus c the database itassetmgt (my database name) in the database explorer. how should i get the backup of the file whn i will need to do ? – Kamesh Biniwale Mar 14 '12 at 19:55