C#.NET FORMS DSN Dialog Box

Greetings...
I am wanting to select a DSN from the ODBC Data Sources so a user can select, create, or update a DSN and then populate the chosen DSN to a Textbox to be used later on.


Example Form
Any wisdom would be graciously appreciated.
Thank you.
LVL 9
Evan CutlerVolunteer Chief Information OfficerAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
You can run Control Panel applets from code, by adding a COM reference to the  'Microsoft Shell Controls and Automation type library.

The Shell32.Shell class has the ControlPanelItem method that takes the name of an applet (i.e. ODBC.cpl).  

The following is an example list of applet names:

            Accessibility
            AddHardware
            ApplicationManager
            AutomaticUpdates
            Desktop
            Drivers
            Internet
            Joystick
            Main
            MicrosoftMail
            NetwareClient
            NetworkSetup
            ODBC
            PowerManagement
            RegionalSettings
            SecurityCenter
            System
            Telephony
            TimeDate
            UserManager
0
 
Bob LearnedCommented:
That depends on what type of DSN that you want.  

1) You can find the System DSN names in the registry under the HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI key.

2) User DSNs are listed in the ODBC.INI file in the %SystemRoot% folder (i.e. C:\Windows)

3) File DSNs are in the C:\Program Files\Common Files\ODBC\Data Sources folder.
0
 
Evan CutlerVolunteer Chief Information OfficerAuthor Commented:
So, If they don't want any of those, I can set a button to create one by executing the ODBC Data Sources program?  then requery?
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
MlandaTCommented:
You have several options. Try them out and choose what works best for you:

1. DataLinks Library
http://www.codeproject.com/Articles/6080/Using-DataLinks-to-get-or-edit-a-connection-string

2. Microsoft.Data.ConnectionUI (UI used by Visual Studio)
http://www.codeproject.com/Articles/21186/SQL-Connection-Dialog

3. UDL.NET (Custom Solution)
http://www.codeproject.com/Articles/59796/UDL-Net-A-ConnectionString-Editor-Built-from-Scrat
0
 
Kalpesh ChhatralaSoftware ConsultantCommented:
0
 
Evan CutlerVolunteer Chief Information OfficerAuthor Commented:
I basically had to make a call.
Press button get Administrator...app will close...
It was the only way I could keep the workflow where it needed to be.

Thanks for the input.
Evan
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.