--- title: "Version Property Example (VB) | Microsoft Docs" ms.prod: sql ms.prod_service: connectivity ms.technology: connectivity ms.custom: "" ms.date: "01/19/2017" ms.reviewer: "" ms.topic: conceptual dev_langs: - "VB" helpviewer_keywords: - "Version property [ADO], Visual Basic example" ms.assetid: 708efd50-2905-4168-b7e4-91b2e9b23539 author: MightyPen ms.author: genemi --- # Version Property Example (VB) This example uses the [Version](../../../ado/reference/ado-api/version-property-ado.md) property of a [Connection](../../../ado/reference/ado-api/connection-object-ado.md) object to display the current ADO version. It also uses several dynamic properties to show: - the current DBMS name and version. - OLE DB version. - provider name and version. - ODBC version. - ODBC driver name and version. ``` 'BeginVersionVB Public Sub Main() On Error GoTo ErrorHandler Dim Cnxn As ADODB.Connection Dim strCnxn As String Dim strVersionInfo As String ' Open connection Set Cnxn = New ADODB.Connection strCnxn = "Provider='sqloledb';Data Source='MySqlServer';" & _ "Initial Catalog='Pubs';Integrated Security='SSPI';" Cnxn.Open strCnxn strVersionInfo = "ADO Version: " & Cnxn.Version & vbCr strVersionInfo = strVersionInfo & "DBMS Name: " & Cnxn.Properties("DBMS Name") & vbCr strVersionInfo = strVersionInfo & "DBMS Version: " & Cnxn.Properties("DBMS Version") & vbCr strVersionInfo = strVersionInfo & "OLE DB Version: " & Cnxn.Properties("OLE DB Version") & vbCr strVersionInfo = strVersionInfo & "Provider Name: " & Cnxn.Properties("Provider Name") & vbCr strVersionInfo = strVersionInfo & "Provider Version: " & Cnxn.Properties("Provider Version") & vbCr MsgBox strVersionInfo ' clean up Cnxn.Close Set Cnxn = Nothing Exit Sub ErrorHandler: ' clean up If Not Cnxn Is Nothing Then If Cnxn.State = adStateOpen Then Cnxn.Close End If Set Cnxn = Nothing If Err <> 0 Then MsgBox Err.Source & "-->" & Err.Description, , "Error" End If End Sub 'EndVersionVB ``` ## See Also [Connection Object (ADO)](../../../ado/reference/ado-api/connection-object-ado.md) [Version Property (ADO)](../../../ado/reference/ado-api/version-property-ado.md)