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 命名空間