app.config文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="LinqOperSQL.Properties.Settings.db_05ConnectionString"
connectionString="Data Source=(local);Initial Catalog=db_05;User ID=sa"
providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="strCon" value="Data Source=(local);Database=db_09;Uid=sa;Pwd=Zz208;"/>
</appSettings>
</configuration>
引用
string strCon = System.Configuration.ConfigurationManager.AppSettings["strCon"].ToString(); //引用要添加 system.configuration

  

app.config 配置的一种用法的更多相关文章

  1. app.config 配置多项 配置集合 自定义配置(3)

    再说说利用app.config配置多个自定义的方法.先看这个例子:美国家庭Simpson的家里有父亲母亲和三个儿女,而中国的老王只有独生子女.结构如下: <?xml version=" ...

  2. App.config“配置系统未能初始化” 异常解决 C#

    System.Configuration.ConfigurationManager.AppSettings["user"]; 时出现“配置系统未能初始化” 错误 解决办法: 如果配 ...

  3. app.config 配置多项 配置集合 自定义配置(2)

    上一篇说了利用app.config自定义节点配置,那是利用工具来实现,其实也一全部编码的方式来实现.举一个栗子.Simpson一家有父亲James,母亲Kate,和三个儿女Jim,Aaron和Luka ...

  4. app.config 配置多项 配置集合 自定义配置

    C#程序的配置文件,使用的最多的是appSettings 下的<add key="Interval" value="30"/>,这种配置单项的很方便 ...

  5. MVC.Net:读取Web.config/App.config配置

    需要读取Web.config/App.config的配置很简单,首先我们需要将配置写入到<appSettings>中,例如: <appSettings> <add key ...

  6. App.config配置详解

    经上一篇文章https://www.cnblogs.com/luna-hehe/p/9104701.html发现自己对配置文件很是不了解,同样还是查了半天终于发现另一片宝贵文档https://www. ...

  7. WCF中,通过C#代码或App.config配置文件创建ServiceHost类

    C# static void Main(string[] args) { //创建宿主的基地址 Uri baseAddress = new Uri("http://localhost:808 ...

  8. app.config 配置多项 配置集合 自定义配置(4) 自动增加配置项到配置文件的两种方法

    一,按照xml文件处理: 配置文件如下图(最后的图片). 自动写入configSections和configSections的实例 1.自动写入configSections Configuration ...

  9. Log4net用法(App.config配置)

    配置文件 <configSections> <section name="log4net" type="log4net.Config.Log4NetCo ...

随机推荐

  1. intellij idea使用技巧

    1 小窗口脱离了主窗口的解决办法 只要将floating mode和windowed mode取消掉就可以了,当选择上了floating mode和windowed mode之后会打一个勾,再次点击勾 ...

  2. 给this添加属性

    const f =()=>{ console.log(this) let a=5 console.log(this) console.log(this) this.ak =3} f() let ...

  3. Swift 学习笔记 (属性)

    属性可以将值与特定的类 结构体 或者枚举联系起来. 存储属性会存储常量或者变量作为实例的一部分.反之计算属性会计算(而不是存储值)值. 计算属性可以由类 结构体 和枚举定义.存储属性只能由类和结构体定 ...

  4. Android笔记之动态地添加View

    使用ViewGroup.addView(View)可动态添加部件,ViewGroup.removeAllViews()用于移除所有部件 示例如下 MainActivity.java package c ...

  5. java ClassLoader类加载器

    原文 首先来了解一下字节码和class文件的区别: 我们知道,新建一个java对象的时候,JVM要将这个对象对应的字节码加载到内存中,这个字节码的原始信息存放在classpath(就是我们新建Java ...

  6. Java for LeetCode 124 Binary Tree Maximum Path Sum

    Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. ...

  7. POJ 2063 Investment (完全背包)

    A - Investment Time Limit:1000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64u Subm ...

  8. Linux tomcat安装详解

    一.tomcat安装 1.下载JDK和Tomcat //通过wget下载 wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8 ...

  9. ActiveMQ之点对点使用

    package com.toov5.producer; import javax.jms.Connection; import javax.jms.JMSException; import javax ...

  10. latex编译过程-关于嵌入所有字体

    我们的初始目的是想在编译的过程中嵌入所有字体 参考 我们进行了设置,但是不起作用,后发现使用pdflatex编译时是不会调用 ps2pdf的 然后,我们就需要了解编译过程 1. 通常,我们使用texs ...