zoukankan      html  css  js  c++  java
  • sqlmanage


    最近又看了看十年前的项目sqlmanage,是一个管理数据库的软件,winform开发的.
    今天整理了一下配置文件,修改了一下图标.
    <?xml version="1.0" encoding="utf-8"?>
    <root>
    <mysql server="localhost" user="root" password="" />
    <sqlserver server="dell-pc" user="sa" password="111111" />
    </root>

    private void xmlsave()
    {
    string strPath = Application.StartupPath + "\Config" + "\sql.xml";
    XmlDocument doc = new XmlDocument();
    doc.Load(strPath);

    XmlNodeList nodeList = doc.SelectSingleNode("root").ChildNodes;
    //string strSpl = " ";

    string server = this.textBoxServer.Text;
    string user = this.textBoxUid.Text;
    string password = this.textBoxPass.Text;
    string type = this.textBox_type.Text;

    var rootnode = doc.SelectSingleNode("root");
    if (type == "mysql")
    {

    XmlElement mysql = doc.CreateElement("mysql");
    mysql.SetAttribute("server", server);
    mysql.SetAttribute("user", user);
    mysql.SetAttribute("password", password);
    //mysql.SetAttribute("server", server);
    rootnode.AppendChild(mysql);

    //XmlNode xn=new XmlNode();
    //rootnode.AppendChild()
    }
    if (type == "sqlserver")
    {

    XmlElement mysql = doc.CreateElement("sqlserver");
    mysql.SetAttribute("server", server);
    mysql.SetAttribute("user", user);
    mysql.SetAttribute("password", password);
    //mysql.SetAttribute("server", server);
    rootnode.AppendChild(mysql);

    //XmlNode xn=new XmlNode();
    //rootnode.AppendChild()
    }

    doc.Save(strPath);
    xmlload();

    }

  • 相关阅读:
    对我影响最大的三位导师
    global与nonlocal
    random模块
    time模块
    datetime模块
    sys模块
    os模块
    collection模块
    hashlib模块
    pickle模块
  • 原文地址:https://www.cnblogs.com/frog2008/p/11615342.html
Copyright © 2011-2022 走看看