码迷,mamicode.com
首页 > 数据库 > 详细

sqlmanage

时间:2019-10-01 15:56:47      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:ext   整理   dell   XML   mysql   spl   root   setattr   string   

作为一个老程序员,比较喜欢回忆.
最近又看了看十年前的项目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();

}

sqlmanage

标签:ext   整理   dell   XML   mysql   spl   root   setattr   string   

原文地址:https://www.cnblogs.com/frog2008/p/11615342.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!