private void btn_Modify_Click(object sender, EventArgs e) { if (txtBox_ServerIp.Text == "") { MessageBox.Show("数据库服务器IP地址不能为空,请指定数据库服务器IP地址。本机数据库服务器IP地址:127.0.0.1 。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtBox_DbName.Text == "") { MessageBox.Show("数据库名称不能为空,请指定需要连接的数据库名称。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtBox_LoginUser.Text == "") { MessageBox.Show("数据库登录用户名不能为空,请指定需要连接的数据库登录用户的名称。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtBox_Passwd.Text == "") { MessageBox.Show("数据库登录用户密码不能为空,请指定需要连接的数据库登录用户密码。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string serverIp = txtBox_ServerIp.Text.Trim(); string dbName = txtBox_DbName.Text.Trim(); string usrName = txtBox_LoginUser.Text.Trim(); string usrPwd = txtBox_Passwd.Text.Trim(); IniFileConfigurer.Write(serverIp, dbName, usrName, usrPwd); if (this.btn_Modify.Text == "创建") { MessageBox.Show("数据库连接配置文件创建成功。", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("数据库连接配置文件修改成功。", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } }