>Hi,
>
>this has to be really simple, but my searching is only turning up things that do not appear to work.
>
>I have an app.config file with the following:
>
>
<?xml version="1.0" encoding="utf-8" ?>
><configuration>
> <appsettings>
> <add key="Client" value="Data Source=MyServer; Initial Catalog=BPOpticalClient; Integrated Security=True"/>
> <add key="Server" value="Data Source=MyServer; Initial Catalog=BPOptical; Integrated Security=True"/>
> </appsettings>
></configuration>
>
>How do I read the Client and Server values from this file?
>
>If I try this:
>
>
string clientConnection = ConfigurationSettings.AppSettings["Client"];
>
>I get a warning that this is obsolete and I should use:
>
>
System.Configuration!System.Configuration.ConfigurationManager.AppSettings
>
>Using that gives me an error:
>
>Other examples I've found give various errors.
>
>Anyone have a simple example that will work for me?
>
>
update>
>I found a sample which worked:
>
>
string clientConnection = ConfigurationManager.AppSettings["Client"];
>
>I don't know why this worked now as I had tried it before.
:-}
But since that looks like connection string info I was wondering why you were not using the connectionString section ?