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();

}

posted on 2019-10-01 14:17  xinshenghu  阅读(246)  评论(0编辑  收藏  举报