12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using UAS_LabelMachine.Entity;
- namespace UAS_LabelMachine
- {
- public partial class MachineSetting : Form
- {
- SqliteDBHelper sdh = SystemInf.sdh;
- public MachineSetting()
- {
- InitializeComponent();
- }
- private void MachineSetting_Load(object sender, EventArgs e)
- {
- DataTable dt = (DataTable)sdh.ExecuteSql("select * from ParamSetting", "select");
- if (dt.Rows.Count > 0)
- {
- ps_ip.Text = dt.Rows[0]["ps_ip"].ToString();
- ps_receiveport.Text = dt.Rows[0]["ps_receiveport"].ToString();
- ps_sendport.Text = dt.Rows[0]["ps_sendport"].ToString();
- ps_resetport.Text = dt.Rows[0]["ps_resetport"].ToString();
- ps_dataindex.Text = dt.Rows[0]["ps_dataindex"].ToString();
- ps_split.Text = dt.Rows[0]["ps_split"].ToString();
- }
- }
- private void SaveSetting_Click(object sender, EventArgs e)
- {
- string sql = "";
- if (sdh.getRowCount("ParamSetting") > 0)
- {
- sql = "update ParamSetting set ps_ip='" + ps_ip.Text + "',ps_receiveport='" + ps_receiveport.Text + "',ps_sendport='" + ps_sendport.Text + "',ps_resetport='" + ps_resetport.Text + "',ps_dataindex='" + ps_dataindex.Text + "',ps_split='" + ps_split.Text + "' where ps_id=1";
- sdh.ExecuteSql(sql, "update");
- }
- else
- {
- sql = "insert into ParamSetting(ps_id,ps_ip,ps_receiveport,ps_sendport,ps_resetport,ps_dataindex,ps_split)";
- sql += "values(1,'" + ps_ip.Text + "','" + ps_receiveport.Text + "','" + ps_sendport.Text + "','" + ps_resetport.Text + "','" + ps_dataindex.Text + "','" + ps_split.Text + "')";
- sdh.ExecuteSql(sql, "insert");
- }
- MessageBox.Show("保存成功");
- Close();
- }
- }
- }
|