private void btn_add_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tb_name.Text)) { MessageBox.Show("请填写姓名!"); } if (string.IsNullOrEmpty(tb_phone.Text)) { MessageBox.Show("请填写手机号!"); } string sex = "1"; if (rb_woman.Checked) { sex = "2"; } string sql = "INSERT INTO Info(name,sex,phone,company,positions,address,creationtime,state) "; sql += $"VALUES ('{tb_name.Text}','{sex}','{tb_phone.Text}','{tb_company.Text}','{tb_position.Text}','{tb_address.Text}','{DateTime.Now}','0') "; int res = DbHelperACE.ExecuteSql(sql); if (res > 0) { MessageBox.Show("新增成功!"); } }
private void btn_updata_Click(object sender, EventArgs e) { string sql = $"UPDATE Info SET phone='{tb_phone.Text}', company='{tb_company.Text}', positions='{tb_position.Text}', address='{tb_address.Text}' WHERE id = {Id}"; int res = DbHelperACE.ExecuteSql(sql); if (res > 0) { MessageBox.Show("修改成功!"); } }
private void btn_del_Click(object sender, EventArgs e) { string sql = $"UPDATE Info SET state = '1' WHERE id = {Id}"; int res = DbHelperACE.ExecuteSql(sql); if (res > 0) { MessageBox.Show("删除成功!"); } }