private void btOui_Click(object sender, EventArgs e) { string findCn = "select careernum from DT_employer where classnum in(select classnum from DT_career where classname ='" + cbWn.Text + "')"; string findSn = "select usernum from DT_USER where username ='******'"; SqlHelp sqlHelper = new SqlHelp(); string careernum = sqlHelper.GetDataReaderValue(findCn); string stunum = sqlHelper.GetDataReaderValue(findSn); string instSql = "insert into DT_YG" + "(stunum,careernum)" + "values('" + stunum + "','" + careernum + "')"; string updtSql1 = "update DT_students set state ='" + cbWn.Text + "' where name ='" + Login.Username + "'"; string updtSql2 = "update DT_employer set neednum =neednum - 1 where careernum ='" + careernum + "'"; string updtSql3 = "update DT_employer set lastnum =lastnum - 1 where careernum ='" + careernum + "'"; int count1 = sqlHelper.ExecuteNonQueryCount(instSql); int count2 = sqlHelper.ExecuteNonQueryCount(updtSql1); int count3 = sqlHelper.ExecuteNonQueryCount(updtSql2); int count4 = sqlHelper.ExecuteNonQueryCount(updtSql3); if (count1 > 0 && count2 > 0 && count3 > 0 && count4 > 0) { right(); Hide(); graduated a = new graduated(); a.ShowDialog(); } else { wrong(); } }
private void button1_Click(object sender, EventArgs e) { Register a = new Register(); SqlHelp sqlHelper = new SqlHelp(); string findMj = "select zynum from dt_zy where zyname ='" + Register.Major + "'"; string findCl = "select yxnum from dt_yx where yxname ='" + Register.College + "'"; string instSql2 = "Insert into DT_students" + "(stunum,name,sex,birthday,[native place],zynum,yxnum,state)" + "values('" + Register.Usernum + "','" + Register.Username + "','" + a.setSex() + "','" + Register.dateofbirth + "','" + Register.Place + "','" + sqlHelper.GetDataReaderValue(findMj) + "','" + sqlHelper.GetDataReaderValue(findCl) + "','" + Register.State + "')"; string instSql1 = "Insert into DT_user" + "(usernum,username,userpass,limits)" + "values('" + Register.Usernum + "','" + Register.Username + "','" + Register.Password + "','" + getLimits() + "')"; int count1 = sqlHelper.ExecuteNonQueryCount(instSql2); int count2 = sqlHelper.ExecuteNonQueryCount(instSql1); if (count1 > 0 && count2 > 0) { right(); if (rBadm.Checked) { admCs(); } else if (rBgrd.Checked) { gdtCs(); } else { wkCs(); } Close(); } }
private void btOk_Click(object sender, EventArgs e) { if (tBpw.Text == "" || tBrpw.Text == "") { wrong1(); } else if (tBpw.Text.Trim() != tBrpw.Text.Trim()) { wrong2(); } else { string updtPw = "update DT_USER set userpass ='******' where username ='******'"; SqlHelp sqlHelper = new SqlHelp(); if (sqlHelper.ExecuteNonQueryCount(updtPw) > 0) { right(); } else { wrong3(); } } Hide(); }
private void btOui_Click(object sender, EventArgs e) { string findSql = "select * from DT_employer where careernum ='" + tbCrn.Text + "'"; string instSql1 = "Insert into DT_employer" + "(careerNUM,classNUM,needNUM,lastNUM,employer)" + "values('" + tbCrn.Text + "','" + tbCln.Text + "','" + tbNn.Text + "','" + tbLn.Text + "','" + tbEr.Text + "')"; SqlHelp sqlHelper = new SqlHelp(); int count2 = sqlHelper.SqlServerRecordCount(findSql); if (tbCln.Text == "" || tbCrn.Text == "" || tbEr.Text == "" || tbLn.Text == "" || tbNn.Text == "") { wrong3(); } else if (count2 > 0) { wrong1(); } else if (int.Parse(tbNn.Text) < int.Parse(tbLn.Text)) { wrong2(); } else if (sqlHelper.ExecuteNonQueryCount(instSql1) > 0) { right(); Close(); } else { MessageBox.Show("存在违规信息,请核实!", "信息提示"); return; } }
private void tsmDlt_Click(object sender, EventArgs e) { if (!this.dataGridView1.Rows[index].IsNewRow) { string selestr1 = "select username from DT_USER where usernum ='" + this.dataGridView1.CurrentCell.Value + "'"; string deletestr1 = "delete from DT_USER where usernum ='" + this.dataGridView1.CurrentCell.Value + "'"; string deletestr2 = "delete from DT_students where stunum ='" + this.dataGridView1.CurrentCell.Value + "'"; SqlHelp sqlHelper = new SqlHelp(); string name = sqlHelper.GetDataReaderValue(selestr1); if (sqlHelper.ExecuteNonQueryCount(deletestr1) > 0 && sqlHelper.ExecuteNonQueryCount(deletestr2) > 0) { this.dataGridView1.Rows.RemoveAt(index); right(name); } } }
private void tsmDlt_Click(object sender, EventArgs e) { if (!this.dataGridView1.Rows[index].IsNewRow) { string deletestr = "delete from DT_employer where careerNum ='" + this.dataGridView1.CurrentCell.Value + "'"; string name = this.dataGridView1.CurrentCell.Value.ToString(); SqlHelp sqlHelper = new SqlHelp(); if (sqlHelper.ExecuteNonQueryCount(deletestr) > 0) { this.dataGridView1.Rows.RemoveAt(index); right(name); } } }
private void btOk_Click(object sender, EventArgs e) { string userSex = ""; string dateofbirth = tbDobn.Text + "/" + tbDobm.Text + "/" + tbDobd.Text; string findCl = "select yxnum from dt_yx where yxname ='" + cbCg.Text + "'"; string findMj = "select zynum from dt_zy where zyname ='" + cbMj.Text + "'"; SqlHelp sqlHelper = new SqlHelp(); if (rbFemale.Checked) { userSex = "女"; } else { userSex = "男"; } string updt = "update DT_students set sex = '" + userSex + "', yxnum ='" + sqlHelper.GetDataReaderValue(findCl) + "', zynum ='" + sqlHelper.GetDataReaderValue(findMj) + "', birthday ='" + dateofbirth + "', [native place] ='" + tbNp.Text + "' where name ='" + lbUnm.Text + "'"; if (cbCg.Text == "" || tbDobd.Text == "" || tbDobm.Text == "" || tbDobn.Text == "" || cbMj.Text == "" || tbNp.Text == "") { wrong1(); } else { if (sqlHelper.ExecuteNonQueryCount(updt) > 0) { right(); } else { wrong2(); } } Hide(); graduated a = new graduated(); a.ShowDialog(); }