From: Mike on
Hi! I can not seem to figure out how to get the value of the defaultDatabase
<dataConfiguration defaultDatabase="mydb"/>
from the app config file.

This does not work because the entry is not in the <appSettings>:

ConfigurationManager.AppSettings["defaultDatabase"]

What are my options? It seems to be so trivial yet....

Many thanks in advance,
From: Tom Shelton on
On 2010-04-27, Mike <Mike(a)discussions.microsoft.com> wrote:
> Hi! I can not seem to figure out how to get the value of the defaultDatabase
><dataConfiguration defaultDatabase="mydb"/>
> from the app config file.
>
> This does not work because the entry is not in the <appSettings>:
>
> ConfigurationManager.AppSettings["defaultDatabase"]
>
> What are my options? It seems to be so trivial yet....
>
> Many thanks in advance,

You can add it to the connectionStrings section...

string connectionString = ConfigurationManager.ConnectionStrings["defaultDatabase"].ConnectionString;
--
Tom Shelton