Version Property Example

This example uses the Version property of a Connection 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, driver name and version, and driver ODBC version.

Public Sub VersionX()

   Dim cnn1 As ADODB.Connection

   ' Open connection.
   Set cnn1 = New ADODB.Connection
   strCnn = “driver={SQL Server};server=srv;” & _
      “user id=sa;password=;database=pubs;”
   cnn1.Open strCnn
   
   strVersionInfo = "ADO Version: " & cnn1.Version & vbCr & _
   "DBMS Name: " & cnn1.Properties("DBMS Name") & vbCr & _
   "DBMS Version: " & cnn1.Properties("DBMS Version") & vbCr & _
   "OLE DB Version: " & cnn1.Properties("OLE DB Version") & vbCr & _
   "Provider Name: " & cnn1.Properties("Provider Name") & vbCr & _
   "Provider Version: " & cnn1.Properties("Provider Version") & vbCr & _
   "Driver Name: " & cnn1.Properties("Driver Name") & vbCr & _
   "Driver Version: " & cnn1.Properties("Driver Version") & vbCr & _
   "Driver ODBC Version: " & cnn1.Properties("Driver ODBC Version")

   MsgBox strVersionInfo

   cnn1.Close

End Sub