共用方式為


Application.GetServerInfo(String, String) Method

Definition

Returns the SQL Server version number of the SQL Server product installed on the target 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)

Parameters

server
String

The name of the server hardware to check for the SQL Server product version.

serverVersion
String

The version number of the SQL Server product, defined as an out parameter.

Examples

The following example retrieves the SQL Server version number from the specified 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  

Remarks

The default value of this property is 9.

Applies to