나는 수가 26 인, 데이터베이스 서버에 오류를 연결할 수없는 것 SQL Server 관리 개체 (SMO) 사용하여 응용 프로그램을 가지고 :SMO를 사용하여 SQL Server에 연결할 수없는 이유는 무엇입니까?
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)
그러나이 유일한 것 같다을 그 데이터베이스에 연결할 수 없습니다. 문제없이 작동 아래 모두를 사용하여 데이터베이스에 연결 :
- SQL Server Management Studio를 PowerShell을
에
System.Data.SqlClient.SqlConnection
Server = new SMO.Server(
new ServerConnection(
new SqlConnectionStringBuilder
{
DataSource = ServerName,
InitialCatalog = DatabaseName,
IntegratedSecurity = true
}.ConnectionString));
Database = Server.Databases[DatabaseName];
내가 발견 한 유일한 것은 내가 내 SQL Server 인스턴스의 sqlcmd -L
전혀 실행하지 않을 때 표시한다는 것입니다. 나는 기본적으로 같은 것을 볼 것으로 예상 :
Servers:
SQL2008
SQL2012
SQL2014
SQL2016
을하지만 그것이 말하는 모든입니다
Servers:
;UID:Login ID=?;PWD:Password=?;Trusted_Connection:Use Integrated Security=?;*APP:AppName=?;*WSID:WorkStation ID=?;