次の方法で共有


Server コンストラクター

Server クラスの新しいインスタンスを初期化します。

名前空間:  Microsoft.SqlServer.Management.Smo
アセンブリ:  Microsoft.SqlServer.Smo (Microsoft.SqlServer.Smo.dll)

構文

'宣言
Public Sub New
'使用

Dim instance As New Server()
public Server()
public:
Server()
new : unit -> Server
public function Server()

説明

既定のコンストラクターは、すべてのフィールドを既定値に初期化します。

使用例

Visual Basic

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'The connection is established when a property is requested.
Console.WriteLine(srv.Information.Version)
'The connection is automatically disconnected when the Server variable goes out of scope.

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
Write-Host $srv.Information.Version