ServerConnection 생성자 (SqlConnection)

Initializes a new instance of the ServerConnection class with the specified connection parameters.

네임스페이스:  Microsoft.SqlServer.Management.Common
어셈블리:  Microsoft.SqlServer.ConnectionInfo(Microsoft.SqlServer.ConnectionInfo.dll)

구문

‘선언
Public Sub New ( _
    sqlConnection As SqlConnection _
)
‘사용 방법
Dim sqlConnection As SqlConnection 

Dim instance As New ServerConnection(sqlConnection)
public ServerConnection(
    SqlConnection sqlConnection
)
public:
ServerConnection(
    SqlConnection^ sqlConnection
)
new : 
        sqlConnection:SqlConnection -> ServerConnection
public function ServerConnection(
    sqlConnection : SqlConnection
)

매개 변수

C#

String connectionString = "Data Source=(local);Initial Catalog=AdventureWorks2012;Integrated Security=SSPI;";
SqlConnection sqlConnection = new SqlConnection(connectionString);
ServerConnection conn = new ServerConnection(sqlConnection);
Server srv = new Server(conn);
Console.WriteLine(srv.Information.Version);

PowerShell

$connectionString = "Data Source=(local);Initial Catalog=AdventureWorks2012;Integrated Security=SSPI;"
$sqlConnection = new-object System.Data.SqlClient.SqlConnection($connectionString)
$conn = new-object Microsoft.SqlServer.Management.Common.ServerConnection($sqlConnection)
#Connect to the local, default instance of SQL Server
$srv = new-object Microsoft.SqlServer.Management.Smo.Server($conn)
Write-Host $srv.Information.Version

참고 항목

참조

ServerConnection 클래스

ServerConnection 오버로드

Microsoft.SqlServer.Management.Common 네임스페이스

관련 자료

SQL Server 인스턴스에 연결