sqlmanage

时间:2022-01-09 04:18:23

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

}

相关文章