this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Monday, April 27, 2009

Read- Write Project Setting throw code .net

Our connection string name and some of other settings mostly resides in our project setting files like app.config or web.config. 

In our code we want to grab this information from these setting files..there is bit a difference in and C# to access this infromation.

In we have My named namespace 

syntax for 
My.Settings.Item("Keyname") = "value to store" 


In C# we have to use System.Configuration name space to access this information.

syntax for c#
System.Configuration.ConfigurationManager.AppSettings["KeyName"]  =  "value to store"

Here,In key name we can also use index of key.

No comments: