动态配置并加密App.Config中数据库连接字符串(5…

2008-02-23 07:43:47来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

45 XmlDocument xDoc = new XmlDocument();
46 xDoc.Load(System.Windows.Forms.Application.ExecutablePath ".config");
47
48 XmlNode xNode;
49 XmlElement xElem1;
50 XmlElement xElem2;
51
52 xNode = xDoc.SelectSingleNode("//connectionStrings");
53
54 xElem1 = (XmlElement)xNode.SelectSingleNode("//add[@name='" AppKey "']");
55 if (xElem1 != null) xElem1.SetAttribute("connectionString", AppValue);
56 else
57 {
58 xElem2 = xDoc.CreateElement("add");

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇: 一条语句简单解决“每个Y的最新X”的SQL经典问题

下一篇: 2007年百度招聘在线笔试真题解答