Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to test if an ODBC DSN exists?
Message
De
27/12/2003 06:56:01
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00862216
Message ID:
00862227
Vues:
16
Hi Joel

>Is there a Windows API that I can use from my VFP code to test if an ODBC DSN exists? For example, say I have an ODBC DSN
called "TrackingDB", how can I test to see if there's an ODBC connection created for this data base?
>
Don't know about an API, but all the information for ODBC connections is stored in the Registry. Information about system DSNs is stored in two sub keys of the “hkey_local_machine\” root key.

The first, “software\odbc\odbcinst.ini”, has one sub key for each driver which lists the settings for that driver. There is also a single sub-key, named “ODBC Drivers”, which lists all installed drivers and could be used to generate a pick-list of available drivers.

The second key, named “software\odbc\odbc.ini”, has one sub key for each DSN that has been defined. Each sub key has entries for the DSN parameters and their values.

Checking the entries under ODBC.INI will tell you whether the specified DSN exists or not...
----
Regards
Andy Kramek
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform