Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programmatically export ODBC settings from Registry
Message
From
06/02/2008 21:23:13
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01290199
Message ID:
01290281
Views:
9
This message has been marked as a message which has helped to the initial question of the thread.
Hi Vince.

>Anyone have an idea as to how to export the ODBC setting from the Registry?

You can use the Registry class in the FFC subdirectory of the VFP home directory to read from the various nodes under HKEY_CURRENT_USER\Software\ODBC (for user DSNs) and HKEY_LOCAL_MACHINE\Software\ODBC (for system DSNs), store the values in a table, and then on another machine, read the values from the table and write to those keys in the Registry. A subclass of Registry called ODBCReg is specifically designed to reading from HKEY_CURRENT_USER\Software\ODBC

Here's some starting code:
local loRegistry, ;
  laDataSources[1], ;
  laKeys[1], ;
  lnI, ;
  lcDataSource
loRegistry = newobject('ODBCReg', home() + 'FFC\Registry.vcx')
loRegistry.GetODBCDrvrs(@laDataSources, .T.)
for lnI = 1 to alen(laDataSources, 1)
  lcDataSource = laDataSources[lnI, 1]
  loRegistry.EnumODBCData(@laKeys, lcDataSource)
* do something with the values in laKeys
next lnI
Doug
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform