Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is this the standard format of app.config file? if yes can you please show me code snippet to access the application settings?


HTML
<pre><?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="LoopDBAnalyzerV1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="LoopDBAnalyzerV1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <connectionStrings>
        <add name="LoopDBAnalyzerV1.Properties.Settings.LoopDBConnectionString"
            connectionString="Data Source=PEESIVABALAN\SQLEXPRESS;Initial Catalog=UserDB1;User Id=sa;Password=abcd" />
    </connectionStrings>
    <applicationSettings>
        <LoopDBAnalyzerV1.Properties.Settings>
            <setting name="Query_1" serializeAs="String">
                <value>SELECT * from DB1</value>
            </setting>
        </LoopDBAnalyzerV1.Properties.Settings>
    </applicationSettings>
    <userSettings>
        <LoopDBAnalyzerV1.Properties.Settings>
            <setting name="Query_2" serializeAs="String">
                <value>SELECT * from Customer</value>
            </setting>
        </LoopDBAnalyzerV1.Properties.Settings>
    </userSettings>
</configuration>
Thanks
Regards
Sutha
Posted

1 solution

C#
System.Configuration.ConfigurationManager.AppSettings["AppSetting"]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900