0

I've created a local DB:

    <connectionStrings>
    <add name="DataAccessLayer.Properties.Settings.TestDBConnectionString"
        connectionString="Data Source=(local)\SQLEXPRESS;AttachDbFilename=|DataDirectory|\bin\TestDB.mdf;Integrated Security=True;User Instance=True"
        providerName="System.Data.SqlClient" />
</connectionStrings>

The project's name is "DataAccessLayer" (class library project). The solution consits of another class library and a web application.

I've sent the solution to my friend to take a look at my code... He has VS2010 installed with SQL Server Express (exactly like me). But when he tries to do a login, he gets the following error:

"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)"

We are trying to fix this like for 4 hours and using google of course - no result.

Any ideas??

Thanks!!!

Sash
  • 493
  • 2
  • 10
  • 19
  • Is it possible that his installed version of SQL has different instance name so (local)\SQLEXPRESS is not correct? That would be my guess. Open Sql Managment studio and see what it says the instance name is. – Matthew Sanford Sep 15 '11 at 21:20
  • Is his sql express instance running? Can you access it via other means? SSMS, etc? – tsells Sep 15 '11 at 23:53

4 Answers4

0

On his box, (local) won't exist. The connection string needs to specify your machine on his box.

Austin Salonen
  • 49,173
  • 15
  • 109
  • 139
  • Thanks for the reply... Do you mean "Data Source=.\SQLEXPRESS" ? We have tried that - didn't worked... – Sash Sep 15 '11 at 21:21
  • @Sash: I mean "Data Source=SashsMachineName\SQLEXPRESS" with the appropriate substitution for your machine name. – Austin Salonen Sep 15 '11 at 21:23
  • You should also check out this question: http://stackoverflow.com/questions/1391503/a-network-related-or-instance-specific-error-occurred-while-establishing-a-connec – Austin Salonen Sep 15 '11 at 21:25
0

Does he put the file at the bin directory ?

Gregory Nozik
  • 3,296
  • 3
  • 32
  • 47
0

If you SQLExpress is well installed on the development machine, just try localhost\SQLExpress instead of (local)\SQLExpress and verify that SQLExpress service is running

VdesmedT
  • 9,037
  • 3
  • 34
  • 50
0

Finally, we managed to find a solution:

'Data Source=.;' instead of 'Data Source=(local)\SQLEXPRESS;' and

'User Instance=False' instead of 'User Instance=True'

I hope this will be useful for someone in the future...

Sash
  • 493
  • 2
  • 10
  • 19