WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADO DAO
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Get Extended ADO Connection-Version Info

 Keywords: Extended ADO Connection Version Info

Sample Code:

; ///////////////////////////////////////////////////////////////////////
; UDF to Gather Extended Version Information for OLE Connections        /
;                                                                       /
; Usage: 1. Create a Valid ADO Connection and Open it                   /
;        2. Call the UDF with                                           /
;           DBVersionInfo(Connection,file)                              /
;                                                                       /
; Where: Connection is the ADODB.Connection Object                      /
;        file is either: passed as ""                                   /
;                        refers to a file, i.e. .XLS,.MDB being opened  /
;                        refers to a DSN, so pass "DSN=DsnName"         /
;                        refers to whatever else you want               /
;                                                                       /
; Returns: a message box display, but could write Inormation to an INI, /
;                                 text file, or another datbase         /
;                                                                       /
; Returns will Vary: All Connections should provide the ADO Version     /
;                    but other 'dynamic properties' are either Provider /
;                    Specific, or not available given the current state /
;                    of the Connection Object, therefore the UDF        /
;                    iterates all properties for matches                /
;                                                                       /
; Stan Littlefield - 11/15/2001                                         /
; ///////////////////////////////////////////////////////////////////////


#DefineFunction DBVersionInfo(DB,file)
cInfo      = StrCat("ADO Version: ",DB.Version,@CRLF)
cTitle     = StrCat( "Connection Information ",file )
props      = DB.Properties
n          = props.Count
For i = 0 To (n-1)
   var     = DB.Properties(i)
   name    = var.Name
   If name == "DBMS Name" Then cInfo = StrCat(cInfo,name,": ",var.Value,@CRLF)
   If name == "DBMS Version" Then cInfo = StrCat(cInfo,name,": ",var.Value,@CRLF)
   If name == "OLE DB Version" Then cInfo = StrCat(cInfo,name,": ",var.Value,@CRLF)
   If name == "Provider Name" Then cInfo = StrCat(cInfo,name,": ",var.Value,@CRLF)
   If name == "Provider Version" Then cInfo = StrCat(cInfo,name,": ",var.Value,@CRLF)
   If name == "Driver Name" Then cInfo = StrCat(cInfo,name,": ",var.Value,@CRLF)
   If name == "Driver Version" Then cInfo = StrCat(cInfo,name,": ",var.Value,@CRLF)
   If name == "Driver ODBC Version" Then cInfo = StrCat(cInfo,name,": ",var.Value,@CRLF)
Next
ObjectClose(props)
Return( message(cTitle,cInfo) )
#EndFunction

file = "C:\Program Files\Microsoft Office\Office10\Samples\SAMPLES.XLS" ; change to suit your environment
cConn = "Provider=MicroSoft.Jet.OLEDB.4.0; Data Source=%file%;Extended Properties=Excel 8.0"
DB = ObjectOpen("ADODB.Connection")
DB.Open(cConn)

DBVersionInfo(DB,file)
Exit

Article ID:   W14659
Filename:   A List of Links to various OLE docs.txt
File Created: 2001:11:15:10:14:12
Last Updated: 2001:11:15:10:14:12