using System.Configuration; ... string connectString = ConfigurationSettings.AppSettings["sqlConnectionString"];
... your config file would look like <configuration> <appSettings> <add key="sqlConnectionString" value="server=localhost; trusted_connection=true" /> </appSettings> </configuration> HTH Deepak > -----Original Message----- > From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of > John Sands > Sent: Saturday, April 27, 2002 4:16 PM > To: [EMAIL PROTECTED] > Subject: Re: [DOTNET] config file for console app > > >> If you console app is myapp.exe, name the file myapp.exe.config > >> If you are using VS.Net, then just add the config file to your project > >> as app.config. VS.Net will then automagically copy that file as <your > >> app name>>.exe.config > > This worked, thanks. But I still can't access the setting from code. > The examples do this: > > this.sqlConnection1.ConnectionString = > ((string)(configurationAppSettings.GetValue("sqlConnection1.ConnectionSt ri > ng", typeof(string)))); > > But this gives a compile error on "configurationAppSettings". Where > does this thing come from? > > Thanks, > John > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.