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 附件内容打印 : Form { DataHelper dh = SystemInf.dh; string custcode; public 附件内容打印(string CustCode) { custcode = CustCode; InitializeComponent(); } private void 附件内容打印_Load(object sender, EventArgs e) { DataTable dt = (DataTable)dh.ExecuteSql("select * from LabelAttachPARAMETER where lap_custcode='" + custcode + "'", "select"); for (int i = 0; i < dt.Rows.Count; i++) { Controls["lap_id" + (i + 1)].Text = dt.Rows[i]["lap_id"].ToString(); Controls["lap_param" + (i + 1)].Text = dt.Rows[i]["lap_param"].ToString(); Controls["lap_value" + (i + 1)].Text = dt.Rows[i]["lap_value"].ToString(); } } private void Confirm_Click(object sender, EventArgs e) { string SQL = ""; for (int i = 1; i < 6; i++) { if (Controls["lap_id" + i].Text == "") { SQL = "insert into LabelAttachPARAMETER(lap_id,lap_custcode,lap_param,lap_value)values(LabelAttachPARAMETER_seq.nextval,'" + custcode + "','" + Controls["lap_param" + i].Text + "','" + Controls["lap_value" + i].Text + "')"; } else { SQL = "update LabelAttachPARAMETER set lap_custcode='" + custcode + "',lap_param='" + Controls["lap_param" + i].Text + "',lap_value='" + Controls["lap_value" + i].Text + "' where lap_id='" + Controls["lap_id" + i].Text + "'"; } dh.ExecuteSql(SQL, "insert"); } MessageBox.Show("保存成功"); Close(); } } }