Databases Reference
In-Depth Information
nRetCode = SQLDrivers(lHEnv, SQL_FETCH_FIRST, sDriverDesc, _
Len(sDriverDesc), nDriverDescLength, sDriverAttr, _
Len(sDriverAttr), nAttrLength)
sAll = ""
Do While nRetCode = SQL_SUCCESS
' Replace NULL separators with colons
sDriverAttributes = Left$(sDriverAttr, nAttrLength - 1)
Do
x = InStr(sDriverAttributes, Chr$(0))
If x = 0 Then Exit Do
sDriverAttributes = Left$(sDriverAttributes, x - 1) & _
" : " & Mid$(sDriverAttributes, x + 1)
Loop
sAll = sAll & Left$(sDriverDesc, nDriverDescLength) & _
" / " & sDriverAttributes & vbCrLf
' Next data source
nRetCode = SQLDrivers(lHEnv, SQL_FETCH_NEXT, sDriverDesc, _
Len(sDriverDesc), nDriverDescLength, sDriverAttr, _
Len(sDriverAttr), nAttrLength)
Loop
Debug.Print "ODBC Drivers"
Debug.Print sAll
nRetCode = SQLFreeHandle(SQL_HANDLE_ENV, lHEnv)
End Sub
The output produced by running ListODBCSources on my system is:
DATA SOURCE / DRIVER
MS Access 7.0 Database / Microsoft Access Driver (*.mdb)
Visual FoxPro Tables / Microsoft Visual FoxPro Driver
Visual FoxPro Database / Microsoft Visual FoxPro Driver
MS Access 97 Database / Microsoft Access Driver (*.mdb)
OLE_DB_NWind_Jet / Microsoft Access Driver (*.mdb)
OLE_DB_NWind_SQL / SQL Server
ConnectExcel / Microsoft Excel Driver (*.xls)
ConnectAccess / Microsoft Access Driver (*.mdb)
ConnectText / Microsoft Text Driver (*.txt; *.csv)
The output of ListODBCDrivers is:
ODBC Drivers
SQL Server / UsageCount=10 : SQLLevel=1 : FileUsage=0 :
DriverODBCVer=02.50 : ConnectFunctions=YYY : APILevel=2 :
\Setup=sqlsrv32.dll : .01= : s=YYN : DSNConverted=F : CPTimeout=60 :
FileExtns=Null
Search WWH ::




Custom Search