zoukankan      html  css  js  c++  java
  • vs 2005中类库如何访问 app.config


      #region 取得Lib的App.config的连接字符串


      try


      {


      string fileFullPath = Assembly.GetExecutingAssembly().CodeBase.Replace("[url=file:///]file:///", string.Empty);


      string filePath = fileFullPath.Substring(0, fileFullPath.LastIndexOf("/")) + "/App.config";


      if (document == null)


      {


      document = new XmlDocument();


      }


      document.Load(filePath);


      connectionString = document.SelectSingleNode(@"/configuration/appSettings/add[@key='connString']").Attributes["value"].Value;


      }


      catch (XmlException ex)


      {


      throw new XmlException(ex.Message);


      }


      #endregion

  • 相关阅读:
    java-多态
    java-继承
    java-访问修饰符
    mysql基础入门
    子查询
    多表查询
    mysql表(多对多)
    myslql主外键约束
    Sql语句分类
    Redis的一些介绍
  • 原文地址:https://www.cnblogs.com/Traner/p/2819982.html
Copyright © 2011-2022 走看看