Export (0) Print
Expand All

OracleConnection.ServerVersion Property

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Gets a string containing the version of the server to which the client is connected.

[Visual Basic]
Public ReadOnly Property ServerVersion As String
[C#]
public string ServerVersion {get;}
[C++]
public: __property String* get_ServerVersion();
[JScript]
public function get ServerVersion() : String;

Property Value

The version of the connected server.

Exceptions

Exception Type Condition
InvalidOperationException The connection is closed.

Remarks

The ServerVersion property is in Oracle version format. For example, the format for an Oracle8 release is a string in the form "8.1.7.0.0 Oracle8 Release 8.1.7.0.0 - Production".

Example

[Visual Basic, C#, C++] The following example creates an OracleConnection and displays some of its read-only properties.

[Visual Basic] 
Public Sub CreateOracleConnection()
    Dim myConnectString As String = "Data Source=Oracle8i;Integrated Security=yes"
    Dim myConnection As New OracleConnection(myConnectString)
    myConnection.Open()
    MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
       + ControlChars.NewLine + "State: " + myConnection.State)
    myConnection.Close()
End Sub

[C#] 
public void CreateOracleConnection() 
 {
    string myConnectString = "Data Source=Oracle8i;Integrated Security=yes";
    OracleConnection myConnection = new OracleConnection(myConnectString);
    myConnection.Open();
    MessageBox.Show("ServerVersion: " + myConnection.ServerVersion
       + "\nState: " + myConnection.State);
    myConnection.Close();
 }

[C++] 
public:
void CreateOracleConnection() 
 {
    String* myConnectString = S"Data Source=Oracle8i;Integrated Security=yes";
    OracleConnection* myConnection = new OracleConnection(myConnectString);
    myConnection->Open();
    MessageBox::Show(String::Format( S"ServerVersion: {0}\nState: {1}",
       myConnection->ServerVersion, __box(myConnection->State)));
    myConnection->Close();
 }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

OracleConnection Class | OracleConnection Members | System.Data.OracleClient Namespace

Show:
© 2014 Microsoft