public static int CLHWInsert(Model.CLHW ch) { SqlHelper.connectionStr = GetSQLConnect(); string sqlstr = "INSERT INTO WMS_CLHW (ID,MaterialName,StoreName,Finalize,FLAG) VALUES ('" + ch.Id + "','" + ch.MterialName + "','" + ch.StoreName + "','',0)"; try { SqlHelper.ExecCommand(sqlstr); return(0); } catch { return(-1); } }
//材料货位保存 private void simpleButton2_Click(object sender, EventArgs e) { if (CheckDataIntegrity1() == true) { Model.CLHW ch = new Model.CLHW(); ch.Id = Guid.NewGuid().ToString(); ch.MterialName = textBox5.Text; ch.StoreName = textBox3.Text; if (SQL.SqlExecute.CLHWInsert(ch) == 0) { MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("保存失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("所填数据必须为非空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error); } }