台州海关TD3600上线版本
This commit is contained in:
54
JJMediSys/SetDB.cs
Normal file
54
JJMediSys/SetDB.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using JJMediSys.cs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static JJMediSys.AlertForm;
|
||||
|
||||
namespace JJMediSys
|
||||
{
|
||||
public partial class SetDB : Form
|
||||
{
|
||||
public SetDB()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void bSaveDB_Click(object sender, EventArgs e)
|
||||
{
|
||||
string newDBconnetstr = "server ="+TextDBIP.Text+"; port ="+TextDBPort.Text+"; user id ="+TextDBUser.Text+"; password ="+TextDBPassword.Text+"; database ="+TextDBName.Text+"; Charset = utf8mb4;";
|
||||
ConfigFileReader.SetValue("/configuration/appSettings/add[@key='Sql']", newDBconnetstr);
|
||||
Login.SqlConnect = newDBconnetstr;
|
||||
AlertForm.ShowAlert("保存成功", AlertType.Success, 3);
|
||||
}
|
||||
|
||||
private void SetDB_Load(object sender, EventArgs e)
|
||||
{
|
||||
int x = (Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2;
|
||||
int y = (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2;
|
||||
this.Location = new Point(x, y);
|
||||
try
|
||||
{
|
||||
string SqlConnect = ConfigFileReader.GetValue("/configuration/appSettings/add[@key='Sql']");
|
||||
DbConnectionStringBuilder builder = new DbConnectionStringBuilder();
|
||||
builder.ConnectionString = SqlConnect;
|
||||
TextDBIP.Text = builder["server"] as string;
|
||||
TextDBPort.Text = builder["port"] as string;
|
||||
TextDBName.Text = builder["database"] as string;
|
||||
TextDBUser.Text = builder["user id"] as string;
|
||||
TextDBPassword.Text = builder["password"] as string;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user