Application.GetServerInfo(String, String) 方法

定义

返回在目标服务器上安装的 SQL Server 产品的 SQL Server 版本号。

public:
 void GetServerInfo(System::String ^ server, [Runtime::InteropServices::Out] System::String ^ % serverVersion);
public void GetServerInfo (string server, out string serverVersion);
member this.GetServerInfo : string * string -> unit
Public Sub GetServerInfo (server As String, ByRef serverVersion As String)

参数

server
String

用于检查 SQL Server 产品版本的服务器硬件的名称。

serverVersion
String

SQL Server产品的版本号,定义为 out 参数。

示例

以下示例从指定服务器检索SQL Server版本号。

static void Main(string[] args)  
        {  
            Application app = new Application();  
            String outParam;  
            app.GetServerInfo("yourserver", out outParam);  
            Console.WriteLine("Server version? " + outParam);  
        }  
Sub Main(ByVal args() As String)  
    Dim app As Application =  New Application()   
    Dim outParam As String  
    app.GetServerInfo("yourserver", out outParam)  
    Console.WriteLine("Server version? " + outParam)  
End Sub  

注解

此属性的默认值为 9

适用于