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

参数

返回值

类型: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)")