"Difference between appsettings and connectionstrings"

Source: Internet
Author: User
Tags connectionstrings

Web. config:

< Configuration >  
< Appsettings >
< Add key = " Sqlconn " Value = " Server = localhost; database = data; uid = sa; Pwd = sa " />
</ Appsettings >
< Connectionstrings >
< Add name = " Dataconnectionstring " Connectionstring = " Data Source = localhost; initial catalog = data; user id = sa; Password = sa " Providername = " System. Data. sqlclient "   />
</ Connectionstrings >
</ Configuration >

Note:
(1) appsonstrins are commonly used in 2003 and connectionstrins are commonly used in 2005.
(2) advantages of using connectionstring:
First, you can encrypt the connection string by using an encryption tool of Ms.
Second, data source controls that can be directly attached without having to writeCodeRead it and assign it to the control.
Third, you can easily change the database platform. For example, if you change to an Oracle database, you only need to modify the providername.
(3) used in <etettings>System. configuration. configurationmanager. receivettings ["name"]Search value.
Used in <connectionstrings>System. configuration. configurationmanager. connectionstrings ["name"]Search value.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.