Finding OLE DB Providers
It is clearly important to be able to determine which OLE DB providers are installed on a particular system. The Windows registry contains entries for each installed OLE DB provider. An example is shown in Figure 17.5.
Figure 17-5. Registry entry for an OLE DB provider
Unfortunately, Windows does not make it a simple matter to extract this registry information using code. The ListDPs procedure shown in Example 17.4 will do the trick. You don’t need to worry about all of the coding details related to the registry, but you may want to change some of the code, since it currently just prints the list of data providers to the Immediate window. Also, don’t forget to include the code in the declarations section, also shown in Example 17.4.
Example 17-4. The ListDPs Procedure
' Declarations for ListDPs Type FILETIME dwLowDateTime As Long dwHighDateTime As Long End Type Public Const HKEY_CLASSES_ROOT = &H80000000 Public Const ERROR_SUCCESS = 0& Public Const KEY_QUERY_VALUE = &H1 Public Const KEY_ENUMERATE_SUB_KEYS = &H8 Public Const KEY_NOTIFY = &H10 Public Const SYNCHRONIZE = &H100000 Public Const STANDARD_RIGHTS_READ = &H20000 Public Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or _ KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE)) Public Const REG_SZ = 1 Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias _ "RegOpenKeyExA" (ByVal hKey ...
Get Access Database Design and Programming, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.