Server.PingSqlServerVersion 方法 (String)
Gets the version number of the instance of 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
A String value that specifies the name of the instance of SQL Server.
返回值
类型:Microsoft.SqlServer.Management.Common.ServerVersion
A ServerVersion object value that specifies the version of the instance of 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)")
请参阅
参考
Microsoft.SqlServer.Management.Smo 命名空间