You can use the <appSettings> element to store a database connection string in the custom settings section of an application configuration file. This element supports arbitrary key-value pairs, as illustrated in the following fragment:

Code
<configuration>
Code
 <appSettings>
Code
  <add key="Shashi"
Code
     value="server=(local);Integrated Security=SSPI;database=Nic"/>
Code
 </appSettings>
Code
</configuration>
Code

Note The <appSettings> element appears under the <configuration> element and not directly under <system.web>.


Advantages

Disadvantages

More Information

Code