2012-10-10 3 views
1

가능한 중복을 SQL 서버 2008를 연결할 수 없습니다 :
System.Data.SqlClient.SqlException A network-related or instance-specific error는 다른 컴퓨터에서

난 내 자신의 DB와 작업을 잘 내 현재 SQL 연결 문자열에 연결하는 C#에서의 WinForm 응용 프로그램이 is :

SqlConnection con = new SqlConnection("Data Source=ITPL_PC1;Initial Catalog=Data_Project;Persist Security Info=True;user id=sa;Password=insforia"); 

그러나이 winform을 다른 컴퓨터 i로 가져갈 때 내가 원격 액세스의 SQL 서버의 모든 설정을 변경 한

SqlConnection con = new SqlConnection("Data Source=192.168.0.28\\ITPL_PC1;Initial Catalog=Data_Project;Persist Security Info=True;user id=sa;Password=insforia"); 

하지만이 작동하지 않습니다 ...하지만 여전히 오류를 보여주는 : TS 작동하지 않습니다 .. 그럼 난에 내 연결 문자열을 변경하고

Sql Exception was unhandled 
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) 

내 연결 문자열이 잘못 되었나요? 그게 뭐야?

PLS는

+0

예 내가 방화벽 설정 – Drone

+0

을 변화했다 (나에게는 심지어 SQL 구성 관리자에서 TCP/IP를 사용하도록 설정 한 후 작동하지 않는) 수행 SQL Server 구성 관리자를 사용하여 TCP-IP 클라이언트 프로토콜을 활성화 했습니까? – Steve

+0

그래, 덕분에 @ damien 나는 그것을 해결했다 – Drone

답변

2
Data Source=ITPL_PC1 

이이 ITPL_PC1라는 서버를 식별 나를 도와. 이 서버의 기본 인스턴스에 연결 중입니다.

Data Source=192.168.0.28\ITPL_PC1 

는 IP 주소 192.168.0.28있는 서버에서 실행되는 예를라는 ITPL_PC1를 식별합니다. 우리는이 서버의 이름을 모른다.

연결하려는 인스턴스가 ITPL_PC1의 기본 인스턴스 인 경우 첫 번째 버전이 항상 작동해야합니다 (ITPL_PC1이 해결 될 경우).

+0

감사합니다 배당금 .... 그것은 단지 ... 실제로'데이터 원본 = 192.168.0.28 \ ITPL_PC1' 내가 인터넷 검색에 의해 이것을 찾았으니 덕분에 – Drone

0
  First you open SQL managnebt studio and connect to another pc sql server : 

     Please follow bolew step : 
      Strat -> program -> window sql server 2008 -> configuration tools 
      --> sql server Configuration manager --> 
      Start sql server browser service 
    ----------- 
    Next --->Sql serverNetework COnfiguration --> Enable all Protocls and 
    also Sql Native Client.. --> Enable all Protocls then 
    -------------- 
    reatsrt all service and connect to sql 
------------------------------------------------- 
If you get connection then SQL Database to connect database from visual studio from there to find connection string and copy and paste to connection string. 
1

Windows 보안이 액세스를 차단했을 수 있습니다. 아래에서해볼 수 있습니다.
1. 실행 창에 services.msc을 입력하여 Windows의 서비스 관리 콘솔로 이동하십시오.
2. 표시된 창에서 서비스 목록을 볼 수 있습니다. 목록에서 Base Filtering Engine을 찾으십시오.
3. 마우스 오른쪽 버튼을 클릭하여 중지하십시오. 그

제가 인터넷 검색을 많이 한 후이 같은 같은 문제를 해결했습니다.

관련 문제