//管理员输入审核用户名时验证该用户是否存在,并提示 private void textBox2_KeyUp(object sender, KeyEventArgs e) { DBlink db = new DBlink(); if (db.DBconn()) { string str = "select * from login_info where username='******'"; if (db.search(str)) { label5.Text = "*删除用户!" + textBox2.Text + "?请点击删除按钮"; button2.Enabled = true; } else { label5.Text = "*用户不存在!"; button2.Enabled = false; } } }
//管理员输入审核用户名时验证该用户是否存在,并提示 private void textBox1_KeyUp(object sender, KeyEventArgs e) { DBlink db = new DBlink(); if (db.DBconn()) { string str = "select * from login_info where tag=0 and username='******'"; if (db.search(str)) { label3.Text = "*该用户未审核!"; button1.Enabled = true; } else { label3.Text = "*用户不存在!"; button1.Enabled = false; } } }
//退出 //删除成绩 private void button7_Click(object sender, EventArgs e) { ScoreInfo.id = textBox6.Text; ScoreInfo.course_id = textBox7.Text; string delsql = "delete from score_info where Id= '" + ScoreInfo.id + "'and Course_Id = '" + ScoreInfo.course_id + "'"; DBlink db4 = new DBlink(); //创建数据库连接对象 if (db4.DBconn()) { //连接数据库 if (db4.UpdataDeletAdd(delsql)) { MessageBox.Show("删除记录成功!"); } else { MessageBox.Show("删除失败!"); } } db4.DBclose();//关闭数据连接 string sql = "SELECT score_info.Id as 学号, score_info.name as 姓名,score_info.course_name as 课程,score_info.score as 成绩 FROM score_info"; BindsocreData(sql); }