PingSqlServerVersion 方法 (String)
取得 SQL Server 執行個體的版本號碼。
命名空間: Microsoft.SqlServer.Management.Smo
組件: Microsoft.SqlServer.Smo (在 Microsoft.SqlServer.Smo.dll 中)
語法
'宣告
Public Function PingSqlServerVersion ( _
serverName As String _
) As ServerVersion
'用途
Dim instance As Server
Dim serverName As String
Dim returnValue As ServerVersion
returnValue = instance.PingSqlServerVersion(serverName)
public ServerVersion PingSqlServerVersion(
string serverName
)
public:
ServerVersion^ PingSqlServerVersion(
String^ serverName
)
member PingSqlServerVersion :
serverName:string -> ServerVersion
public function PingSqlServerVersion(
serverName : String
) : ServerVersion
參數
- serverName
型別:System. . :: . .String
String 值,指定 SQL Server 執行個體的名稱。
傳回值
型別:Microsoft.SqlServer.Management.Common. . :: . .ServerVersion
ServerVersion 物件值,指定 SQL Server 執行個體版本。
範例
C#
Server srv = new Server("(local)");
Console.WriteLine(srv.PingSqlServerVersion("(local)"));
PowerShell
$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
Write-Host $srv.PingSqlServerVersion("(local)")