Retrieving specific DSN configuration data

Dec 27 2006 12:50 PM
I am writing a C# WinForm application to work with ODBC DSN configuration data.
My form has a text box that will take a particular DSN name as a search value. I want to be able to do the following two things:
#1) Retrieve a specific DSN by name, i.e., HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\MyDSN interate through ALL the "name", "data type", & "value"s associated with that particular DSN and write the data to a file.

Also, #2) retrieve this information and recreate the DSN using this data.

I can see several DSNs via LocalMachine\Software\ODBC\ODBC.INI\ODBC Data Sources. However, I want to retrieve just a specific DSN by name and acquire its values.

Any coding suggestions to accomplish this would be much appreciated. Thank you.