Click here to Skip to main content
12,698,048 members (23,008 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# .NET SQL-Server .NET4
dear friends,
i create setup file and instal it on another PC.
when run the software an error will show like this:
"A network related or instance-specific error occured while establishing to sql server.the server was not found or was not accessible.verify that the instance name is correct and that sql server is "
my connection string is:
con="server=.,database=book,integrated security=sspi";

please help.what is the problem? .
Posted 15-Aug-12 1:32am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

your servername is missing, I think if you are using sql express then use .\SQLEXPRESS

so your connection string looks something like
con="server=.\sqlexpress,database=book,integrated security=sspi";

updated if ur servername is mostafaPC, then

con="server=MostafaPc,database=book,integrated security=sspi";
MP59 15-Aug-12 6:48am
it is not sqlExpress,]
it is sql server
Santhosh Kumar J 15-Aug-12 6:50am
then wats ur server name?
MP59 15-Aug-12 6:51am
it is mostafaPC
Santhosh Kumar J 15-Aug-12 6:57am
updated the solution. It should be con="server=MostafaPc,database=book,integrated security=sspi";
MP59 15-Aug-12 7:00am
but if i instal the program on other systems,does it work with this con?
Santhosh Kumar J 15-Aug-12 7:02am
In which machine You have installed SQL server? And whats the servername for that instance? If it is proper , then from other machines also you can access the sql server. But you have said integrated security=true. So before you try to login from other machines, check that windows user has permission in sql server to login
MP59 15-Aug-12 7:05am
you mean i should instal sql server on other machin before instal my program?
Santhosh Kumar J 15-Aug-12 7:07am
no. use the same server u already have. just give windows authentication permission to the users in other machine.
MP59 15-Aug-12 7:10am
so it will solve when integrated security=true and servername=local
is it right?
Santhosh Kumar J 15-Aug-12 7:11am
no..please google how to use connection string. I said server name will be always same..
MP59 15-Aug-12 7:12am
MP59 15-Aug-12 7:15am
how to give windows authentication permission to the users in other machine?
Santhosh Kumar J 15-Aug-12 7:17am
Configuring SQL Server

To configure SQL Server for Windows integrated security:

From the Windows Start menu, choose Microsoft SQL Server, and then choose Enterprise Manager.
Open the node for the server and expand the node for the database you want to give users permissions for.
Right-click the Users node and choose New Database User.
In the Database User Properties dialog box, enter domain\username in the Login name box, and then click OK. Alternatively, configure the SQL Server to allow all domain users to access the database.
MP59 15-Aug-12 7:18am
ok.very very good.thanks for ever.
Santhosh Kumar J 15-Aug-12 7:20am
mark it as solved,plz
Santhosh Kumar J 15-Aug-12 7:19am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170118.1 | Last Updated 15 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100