A word plug-in is implemented in a class library project. The configuration information is stored in the configuration file app of the class library project. in config, use the following method to obtain the doctype node information in the configuration file after packaging.
C # application configuration file App. config usage summary,
Add reference System. Configuration. dll, using System. Configuration;
The application configuration file is a standard XML file, and the XML tag and attribute are case
Encrypt the winform app. config file
Recently, I am working on a winform project. Because I am using the client to directly connect to the database, I need to deploy the app on the client. config. Because Enterprise Library is used. the connectionstrings In the config file
The value of App. config can be understood to be static in memory, that is, the general program is running, and this value is not updated.In fact, you just need to update the database path in the. exe.config file. Only need to restart the application after the update operation is completeSo that the configuration will take effect. In n multi-data, found. Vshost.e
vs in C # Three ways to read the app. Config database configuration string (GO) http://hi.baidu.com/mindox/item/3278dc352c7ba68fb80c0389http//www.blogjava.net/keweibo/articles/391207.htmlthree ways to configure a database configuration string in VS2008 or VS2005 VS2008 when you create a form program, if you add a data
1. Adding configuration FilesCreate a new WinForm application, similar to Webfrom under a web.config,winform also has an app. config, but app. config is not auto-generated and needs to be added manually, right-click Project-〉 Add-〉 Add New Item-〉 add Application profile file
Custom ApplicationProgramConfiguration file (App. config)1. configuration file Overview:The application configuration file is a standard XML file, and the XML tag and attribute are case sensitive. It can be changed as needed. developers can use the configuration file to chan
There are two ways://To get the connection string by reading the configuration fileThe first way:Format of app. Config file:Read the string in the configuration file in SqlHelper by code: (Add Reference: Using System.Configuration;)private static readonly String constr = configurationmanager.connectionstrings["Sqlconns
C # operation configuration file app. configBefore the emergence of c #, applications usually use ini or xml as configuration files. However, after the emergence of c #, most programmers still choose to use a highly operable. config application configuration file. Therefore,
C # operation configuration file app. configBefore the emergence of c #, applications usually use ini or xml as configuration files. However, after the emergence of c #, most programmers still choose to use a highly operable. config application configuration file. Therefore,
Public classConfigoperator {#regionGet value from configuration file/// ///get value from configuration file/// /// the key string in the configuration file /// Public Static stringGetvaluefromconfig (stringkey) { Try{Configuration config
500,100, 50 and 10 respectively. But after the change, I had to restart the service to get the configuration file to work. After a few times this kind of toss, feel the experience is too bad.On the Internet a search, found this article: Do you has to restart a Windows service if you change the app. config? In the original question, a friend gave the answer, that
We know that in winform or console applicationProgram, We can use the app. config file to store the configuration information of the program. Then we use the system. configuration class for calling, reading, or updating. . Config file. Then we will automatically call this
If the configuration file contains a configsections element, the configsections element must be the first child element of the configuration element. After placing the appsettings in configsections, it is normal.The elements in the configsections must correspond to the following custom configuration section one by one.For example, there are 4 custom
XML version= "1.0" encoding= "Utf-8"?>Configuration> connectionStrings> Addname= "Dbconnstr"connectionString= "Data source=.;i Nitial catalog=test; User Id=sa; Password=newmap "/> connectionStrings>Configuration>Create a new item "Application configuration file" in VS and configure it by the code above, and don't forget to add a reference in Solution manager
The first of these methodsWriting:"connectionstring" value= " server=127.0.0.1;uid=sa;pwd=123456;database=power"/> Call:string rode= system.configuration.configurationsettings.appsettings["connectionstring "];The second method ofWriting:"CONNECTIONS " connectionstring= " Server=10.10.10.1;database=mydbtest; Uid=sa; Pwd=sa" />Call:string ConnectionStr = system.configuration.configurationsettings.appsettings["CONNECTIONS" ];Two ways of writing SQL database connection strings within the
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.