0

I am developing an application that contains a small SQL Server database File.

On my machine, it works fine. I am using Microsoft Visual C# Express 2010.

I have sent my project to a colleague. He is using the same software. And he has placed the database file in the same place (c:\folder\db.mdf). However, he gets the following error when trying to open the connection:

System.Data.SqlClient.SqlException was unhandled
Message=A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

How can I help my colleague get connected? He is on the other side of the country.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Ginger
  • 8,320
  • 12
  • 56
  • 99
  • Does your colleague have SQL Server Express (same version or newer) installed? What does your connection string look like (to make the connection to the database)?? – marc_s Jul 16 '11 at 10:40
  • The error messages says that the SQL server could not be found (on his machine). You may need to edit the connection string. – ta.speot.is Jul 16 '11 at 11:04
  • The connection string is: @"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\betfairData\db.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; I do not know whether or not the user has Visual SQL Express installed, but he assures me that the datbase file is in the correct place. – Ginger Jul 16 '11 at 11:36

1 Answers1

0

There are several ways to copy a database from one machine to another - the way I normally do it is to use SQL Server management studio to do a backup on the "from" and then to do a restore on the "to".

For more information, check out questions/answers like:

Community
  • 1
  • 1
Stuart
  • 66,722
  • 7
  • 114
  • 165