1. Reading from App.config file:
    using System.Configuration;

    To read from app.config file you may use the following code:
    private string ReadFromAppConfig(string key)
    {
     return ConfigurationManager.AppSettings[key];
    }

    To write to app.config file you may use the following code:
    private void WriteToAppConfig(string key, string value)
    {
     Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
     config.AppSettings.Settings[key].Value  = value;
     config.Save(ConfigurationSaveMode.Modified);
     ConfigurationManager.RefreshSection("appSettings");
    }


    Sample App.Config file:
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <appSettings>
        <add key="TimerInterval" value ="9000"/>
      </appSettings>
    </configuration>
    1

    View comments

  2. Don't forget to put:
    cmd.CommandType = CommandType.StoredProcedure; 
    0

    Add a comment


  3. I received the following error while using a sample application from a third party client. 


    Solution:  Changed the ‘Active Solution Platform’ from ‘Any CPU’ to ‘x86’

    0

    Add a comment

Blog Archive
Topics
Topics
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.