Implementation Method: use the registry class provided by Microsoft. win32 to access the system registry to obtain the ODBC Data Service list.
Specific implementation:
Microsoft. win32 provides the RegistryKey class to access the registry of the system.
/// Define the registry sub-Path
String strRegPath = @ "SOFTWAREODBCODBC. INIODBC Data Sources ";
/// Create two RegistryKey classes. One Class points to the Root Path and the other class points to the sub-Path.
RegistryKey regRootKey;
RegistryKey regSubKey;
/// Define Root to point to the Registry HKEY_LOCAL_MACHINE Node
RegRootKey = Registry. LocalMachine;
/// The Registry enumeration class provides the following types
/*
Registry. ClassesRoot --------------> points to the HKEY_CLASSES_ROOT node of the Registry.
Registry. CurrentConfig --------------> points to the HKEY_CURRENT_CONFIG node of the Registry.
Registry. CurrentUser --------------> points to the Registry HKEY_CURRENT_USER Node
Registry. DynData --------------> points to the HKEY_DYN_DATA node of the Registry (Dynamic Registry data)
Registry. LocalMachine --------------> points to the Registry HKEY_LOCAL_MACHINE Node
Registry. PerformanceData --------------> points to the Registry HKEY_PERFORMANCE_DATA Node
Registry. Users --------------> points to the HKEY_USERS node of the Registry.
*/