List configured databases

Topics: Data Access Application Block
Feb 5, 2007 at 9:47 PM
I have written a Windows forms database that I am using DAAB for and would like to let the user configure which database they use by going to the Tools->options form and selecting from a list of configured databases.

What I am wondering is if there is a way to get a list of databases via the DAAB or should I just parse the xml?


Feb 5, 2007 at 9:55 PM
Edited Feb 5, 2007 at 9:56 PM
The DAAB uses the ConnectionStrings Section of your web.config / app.config, so getting the list of connection strings is as simple as reading the section. You don't have to do anything with the DAAB.

Here is a quick tutorial I found on MSDN. I am sure there are others. Note: the example is for web.config, so you would need to adjust it for a Winform application




David Hayden
Microsoft MVP C#
Feb 6, 2007 at 2:36 PM
Thanks that was exactly what I was looking for.