private void button1_Click(object sender, EventArgs e) { if (!Regex.IsMatch(textBox1.Text, "^[1-9]")) { MessageBox.Show("输入正确的学分!", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); return; } else { string sno = (comboBox2.Text.ToString()).Split('-')[0]; string cno = (selectCourse.Text.ToString().Split('-'))[0]; // string sql = "insert into score(sno,cno,grade) values('" + sno + " ','" + cno + " '," + textBox1.Text.ToString() + ")"; string sql = "update score set grade = '" + textBox1.Text + "' where sno = '" + sno + "' and cno = '" + cno + "';"; //insert into course(cno, cname, ccategory, credit) if (op.OPSQL(sql)) { //ClearText(); MessageBox.Show("更新成功!"); } else { MessageBox.Show("更新失败!"); } } }
private void button5_Click(object sender, EventArgs e) { string sql = "update course set cname='" + textBox2.Text + "',ccategory='" + comboBox1.SelectedItem + "',credit='" + textBox3.Text + "' where cno='" + textBox1.Text + "'"; if (op.OPSQL(sql)) { ClearText(); MessageBox.Show("修改成功!"); } else { MessageBox.Show("修改失败!"); } }
private void skinButton1_Click(object sender, EventArgs e) { if (skinComboBox1.SelectedItem.ToString() == "") { MessageBox.Show("请选择课程!"); return; } else { string tno = User.getuNo(); string cno = (skinComboBox1.Text.ToString().Split('-'))[0]; string sql = "update Teacher_teaching set exam_time = '" + dateTimePicker1.Value + "' where cno = '" + cno + "' and tno = '" + tno + "';"; //insert into course(cno, cname, ccategory, credit) if (op.OPSQL(sql)) { //ClearText(); MessageBox.Show("更新成功!"); } else { MessageBox.Show("更新失败!"); } } }
private void skinButton1_Click(object sender, EventArgs e) { if (richTextBox1.Text != "") { //string sql = "insert into student(sno,sname,ssex,sclass,zno,Admission_time,Graduation_time,inschool) values('" + skinTextBox1.Text.ToString() + "','" // + skinTextBox2.Text + "','" + skinComboBox1.SelectedItem + "','" + skinTextBox3.Text + "','" //+ skinComboBox2.SelectedItem + "','" + dateTimePicker1.Value + "','" //+ dateTimePicker2.Value + "'," + skinComboBox3.SelectedItem + ")"; string sql = "insert into Notice(datetime,text) values('" + label1.Text + "','" + richTextBox1.Text + "')"; if (op.OPSQL(sql)) { //ClearText(); MessageBox.Show("新建成功!"); } else { MessageBox.Show("创建失败!"); } } else { MessageBox.Show("信息输入不全!"); } }
private void skinButton1_Click(object sender, EventArgs e) { if (comboBox1.SelectedItem.ToString() == "") { MessageBox.Show("请选择课程!"); return; } else { string sno = User.getuNo(); string cno = (comboBox1.Text.ToString().Split('-'))[0]; //获取该课程的授课老师编号 string sql = "select tno from Teacher_teaching where cno ='" + cno + "'"; string tno = op.FiledValue(sql); if (tno != "") { sql = "insert into grade(sno,cno,tno)values ('" + sno + "','" + cno + "','" + tno + "');"; if (op.OPSQL(sql)) { MessageBox.Show("选课成功"); } } else { MessageBox.Show("该课程还未安排老师"); } } }
private void timer1_Tick(object sender, EventArgs e) { string strCmd = "select count(*) from grade where sno='" + User.getuNo() + "' AND grade_prompt is null;"; if (int.Parse(op.FiledValue(strCmd)) > 0) { MessageBox.Show("您有未查看的成绩!"); strCmd = "UPDATE grade SET grade_prompt ='1' where sno='" + User.getuNo() + "'AND grade_prompt is null;"; if (op.OPSQL(strCmd)) { //timer1.Enabled = false; return; } else { MessageBox.Show("未知错误"); } } }
private void button1_Click(object sender, EventArgs e) { if (txtID.Text != "") { //string sql = "insert into student(sno,sname,ssex,sclass,zno,spsw,Admission_time,Graduation_time,inschool) values('" + txtID.Text + "','" + txtName.Text + "','" + comboSex.SelectedItem + "','" + txtclass.Text + "','" + txtzno.Text + "','123','" + dateTime.Value + "','" + dateTime1.Value + "','" + comboBox1.SelectedItem + "')"; string sql = "insert into student(sno,sname,ssex,sclass,zno,spsw,Admission_time,Graduation_time,inschool)values ('" + txtID.Text + "','" + txtName.Text + "','" + comboSex.SelectedItem + "','" + txtclass.Text + "','" + txtzno.Text + "','123','" + dateTime.Value + "','" + dateTime1.Value + "','" + comboBox1.SelectedItem + "')"; if (op.OPSQL(sql)) { //ClearText(); MessageBox.Show("新建成功!"); } else { MessageBox.Show("创建失败!"); } } else { MessageBox.Show("信息输入不全!"); } }
private void button5_Click(object sender, EventArgs e) { string sql = "update student SET inschool=0 where Graduation_time<getdate()"; if (op.OPSQL(sql)) { //ClearText(); MessageBox.Show("更改成功!"); } else { MessageBox.Show("更改失败失败!请重试!"); } }
private void skinButton1_Click(object sender, EventArgs e) { if (skinTextBox1.Text != "") { string sql = "UPDATE teacher SET tno = '" + skinTextBox1.Text + "',tname = '" + skinTextBox2.Text + "', tsex = '" + skinComboBox1.SelectedItem + "', tduties='" + skinComboBox2.SelectedItem + "' WHERE tno = '" + skinTextBox1.Text + "'"; //string sql = "insert into student(sno,sname,ssex,date,nation,nativeplace,grade,profession,scholarship) values('" + txtID.Text + "','" + txtName.Text + "','" + comboSex.SelectedItem + "','" + dateTime.Value + "','" + txtNation.Text + "','" + txtNative.Text + "','" + txtScore.Text + "','" + comboMajor.SelectedItem + "','" + txtGrant.Text + "')"; if (op.OPSQL(sql)) { //ClearText(); MessageBox.Show("更新成功!"); } else { MessageBox.Show("更新失败!"); } } else { MessageBox.Show("请输入要修改的职工号"); } }
private void button1_Click(object sender, EventArgs e) { String idGoods = (comboBox1.Text.ToString()).Split('-')[0]; String idUser = (comboBox2.Text.ToString()).Split('-')[0]; String amount = textBox1.Text.ToString(); if (idGoods == "" || idUser == "" || amount == "") { MessageBox.Show("商品、客户、订购数量不能为空!!!"); return; } if (op.OPSQL(od.getCmdInsertOrder(idGoods, idUser, amount))) { MessageBox.Show("添加成功"); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != "" || textBox2.Text != "" || textBox3.Text != "") { string sql = "insert into course(cno,cname,ccategory,credit) values('" + textBox1.Text + "','" + textBox2.Text + "','" + comboBox1.SelectedItem + "','" + textBox1.Text + "')"; if (op.OPSQL(sql)) { MessageBox.Show("课程添加成功!"); } else { MessageBox.Show("添加失败!"); } } else { MessageBox.Show("信息输入不全!"); } }
private void skinDataGridView1_CellEndEdit_1(object sender, DataGridViewCellEventArgs e) { //获取行号 int rowindex = e.RowIndex; string value0 = skinDataGridView1.Rows[rowindex].Cells[0].Value.ToString(); string value1 = skinDataGridView1.Rows[rowindex].Cells[1].Value.ToString(); string value2 = skinDataGridView1.Rows[rowindex].Cells[2].Value.ToString(); string value3 = skinDataGridView1.Rows[rowindex].Cells[3].Value.ToString(); string sql = "UPDATE Teacher_teaching SET lesson_time = '" + value3 + "' WHERE tno = '" + value0 + "' and cno = '" + value1 + "'"; //string sql = "update grade set grade='" + value3 + "' where sno='" + value0 + "'and cno='" + value1 + "'and tno='" + value2 + "'"; if (op.OPSQL(sql)) { //修改成功 label1.Text = "更新课表信息成功!! 职工号:" + value0 + " 行号:" + rowindex; //MessageBox.Show("修改成功!"); } else { MessageBox.Show("更新课表信息失败!!职工号:" + value0 + " 行号:" + rowindex); label1.Text = "更新课表信息失败!! 职工号:" + value0 + " 行号:" + rowindex; } }
private void skinDataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { //获取行号 int rowindex = e.RowIndex; string value0 = skinDataGridView1.Rows[rowindex].Cells[0].Value.ToString(); string value1 = skinDataGridView1.Rows[rowindex].Cells[1].Value.ToString(); string value2 = skinDataGridView1.Rows[rowindex].Cells[2].Value.ToString(); string value3 = skinDataGridView1.Rows[rowindex].Cells[3].Value.ToString(); string sql = "update grade set grade='" + value3 + "' where sno='" + value0 + "'and cno='" + value1 + "'and tno='" + value2 + "'"; if (op.OPSQL(sql)) { //修改成功 skinLabel1.Text = "更新成绩成功!! 学号:" + value0 + " 行号:" + rowindex; //MessageBox.Show("修改成功!"); } else { MessageBox.Show("更新成绩成功!!学号:" + value0 + " 行号:" + rowindex); skinLabel1.Text = "更新成绩失败!! 学号:" + value0 + " 行号:" + rowindex; } }