How to Use and differentiate add key and add name

Source: Internet
Author: User

From http://hi.baidu.com/%D0%C7%B7%C9%D4%C2%C2%E4/home

"

 

 <  Configuration  >  

< Appsettings >

< Add key = " Myconfig " Value = " Data Source =.; initial catalog = xbmis; user id = sa; Pwd =: " />

< Add key = " Crystaliamgecleaner-autostart " Value = " True " />

< Add key = " Crystalimagecleaner-sleep " Value = " 6000 " />

< Add key = " Crystalimagecleaner-age " Value = " 120000 " />

</ Appsettings >

< Connectionstrings >

< Add name = " Xbmisconnectionstring " Connectionstring = " Data Source =.; initial catalog = xbmis; persist Security info = true; user id = sa; Password = "

Providername = " System. Data. sqlclient " />

< Connectionstrings >

 

InProgramCentralized reference is as follows:

Use the namespace system. configuration, that is, using system. Configuration

 

 

 System. configuration. configurationmanager. configurettings [ "  Myconfig  "  ]

Get Data Source = .; Initial catalog = Xbmis; User ID = SA; pwd = :

System. configuration. configurationmanager. connectionstrings [ " Xbmisconnectionstring " ]. Connectionstring

Get Data Source = .; Initial catalog = Xbmis; persist Security info = True; User ID = SA; Password = "

Providername = " System. Data. sqlclient

 

Note: The underlined part after the namespace system. configuration is referenced can be omitted.

<Etettings> is generally used to configure common values <connectionstrings>. It is generally used to configure database connections.
Not mandatory. You can write an XML file for configuration.
It is convenient here.

"

"

<Appsettings> is generally used to configure common values.
<Connectionstrings>
Used to configure database connections
Not mandatory. You can write an XML file for configuration.
It is convenient here.

"

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.