private void btn_Execute_Click(object sender, EventArgs e) { if (txt_ID.Text.Length != 0 && txt_BS.Text.Length != 0 && txt_ES.Text.Length != 0) { string strSql; DataConnector data = new DataConnector(); strSql = "insert into Salary ( ID , BS , Tax , ES ) values('" + txt_ID.Text + "','" + txt_BS.Text + "','" + txt_tax.Text + "','" + txt_ES.Text + "')"; data.dataCon(); if (data.sqlExec(strSql)) { MessageBox.Show("添加成功!!\r\n表中数据将会更新.", "结果", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("添加失败!!\r\n请确认输入的数据.", "关键性错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("必须的字段未满足!!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_Execute_Click(object sender, EventArgs e) { if (txt_ID.Text.Length != 0 && txt_Name.Text.Length != 0 && txt_Sex.Text.Length != 0 && txt_Birthday.Text.Length != 0 && txt_Inworkdate.Text.Length != 0) { string strSql; DataConnector data = new DataConnector(); strSql = "insert into Employee ( E_ID , E_Name , E_Sex , E_Age , E_Birthday , E_InworkDate , E_Position , E_Phone , E_Address ) values('" + txt_ID.Text + "','" + txt_Name.Text + "','" + txt_Sex.Text + "','" + txt_Age.Text + "','" + txt_Birthday.Text + "','" + txt_Inworkdate.Text + "','" + txt_Position.Text + "','" + txt_Phone.Text + "','" + txt_Address.Text + "')"; data.dataCon(); if (data.sqlExec(strSql)) { MessageBox.Show("添加成功!!\r\n表中数据将会更新.", "结果", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("添加失败!!\r\n请确认输入的数据.", "关键性错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("必须的字段未满足!!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_Execute_Click(object sender, EventArgs e) { if (txt_ID.TextLength != 0 && txt_Name.TextLength != 0 && txt_Sex.Text.Length != 0 && txt_Birthday.TextLength != 0 && txt_Inworkdate.TextLength != 0) { string strSql; DataConnector data = new DataConnector(); strSql = $"UPDATE Employee SET E_Name = '{txt_Name.Text}' , E_Sex = '{txt_Sex.Text}' , E_Age = '{txt_Age.Text}' , E_Birthday = '{txt_Birthday.Text}' , E_InworkDate = '{txt_Inworkdate.Text}' , E_Position = '{txt_Position.Text}' , E_Phone = '{txt_Phone.Text}' , E_Address = '{txt_Address.Text}' WHERE E_ID= '{txt_ID.Text}'"; data.dataCon(); if (data.sqlExec(strSql)) { MessageBox.Show("修改成功!!\r\n表中数据将会更新.", "结果", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("修改失败!!\r\n请确认输入的数据.", "关键性错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("必须的字段未满足!!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btn_Execute_Click(object sender, EventArgs e) { if (txt_ID.TextLength != 0 && txt_BS.TextLength != 0 && txt_ES.TextLength != 0) { string strSql; DataConnector data = new DataConnector(); strSql = $"UPDATE Salary SET BS = '{txt_BS.Text}' , Tax = '{txt_tax.Text}' , ES = '{txt_ES.Text}' WHERE ID= '{txt_ID.Text}'"; data.dataCon(); if (data.sqlExec(strSql)) { MessageBox.Show("修改成功!!\r\n表中数据将会更新.", "结果", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("修改失败!!\r\n请确认输入的数据.", "关键性错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("必须的字段未满足!!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }