protected void Button2_Click(object sender, EventArgs e) { Label8.Visible = false; Label9.Visible = false; Label10.Visible = false; if (TextBox1.Text == "" || TextBox2.Text == "") { Label8.Visible = true; } else { bool b; string pass = "******"; b = dataconn.eccom("insert into user(user_id,name,job_id,store_id,password)values('" + this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + DropDownList1.SelectedValue + "','" + DropDownList4.SelectedValue + "','" + pass + "')"); if (b) { Label10.Visible = true; dataconn.eccom("create view " + this.TextBox1.Text + " as select user_id,name,job_id,store_id,password from user where user_id='" + this.TextBox1.Text + "'"); } else { Label9.Visible = true; } } }
private void SingleProblem() { int A = 0;//导入成功数 string cunzai = ""; try { string fileName1 = fileName; //根据路径打开一个Excel文件并将数据填充到DataSet中 //string strConn = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'", excelFilePath); string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source = " + fileName1 + ";Extended Properties ='Excel 8.0;HDR=NO;IMEX=1'";//导入时包含Excel中的第一行数据,并且将数字和字符混合的单元格视为文本进行导入 OleDbConnection conn = new OleDbConnection(strConn); conn.Open(); string strExcel = "select * from [sheet1$]"; OleDbDataAdapter comm = new OleDbDataAdapter(strExcel, strConn); DataSet ds = new DataSet(); for (int i = 1; i < GridView1.Rows.Count; i++) { try { if (GridView1.Rows[i].Cells[0].Text.ToString().Trim() == "" || GridView1.Rows[i].Cells[1].Text.ToString().Trim() == "" || GridView1.Rows[i].Cells[2].Text.ToString().Trim() == "" || GridView1.Rows[i].Cells[3].Text.ToString().Trim() == "" || GridView1.Rows[i].Cells[4].Text.ToString().Trim() == "" || GridView1.Rows[i].Cells[5].Text.ToString().Trim() == "" || GridView1.Rows[i].Cells[6].Text.ToString().Trim() == "" || GridView1.Rows[i].Cells[7].Text.ToString().Trim() == "" || GridView1.Rows[i].Cells[8].Text.ToString().Trim() == "") { Response.Write("<script>alert('" + "ID:" + GridView1.Rows[i].Cells[0].Text.ToString().Trim() + "信息不完整!" + "')</script>"); } else { db.eccom("insert into SingleProblem(c_id,Title,AnswerA,AnswerB,AnswerC,AnswerD,Answer,Grade,Chapter) values ('" + GridView1.Rows[i].Cells[0].Text.ToString().Trim() + "','" + GridView1.Rows[i].Cells[1].Text.ToString().Trim() + "','" + GridView1.Rows[i].Cells[2].Text.ToString().Trim() + "' ,'" + GridView1.Rows[i].Cells[3].Text.ToString().Trim() + "' ,'" + GridView1.Rows[i].Cells[4].Text.ToString().Trim() + "' ,'" + GridView1.Rows[i].Cells[5].Text.ToString().Trim() + "' ,'" + GridView1.Rows[i].Cells[6].Text.ToString().Trim() + "' ,'" + GridView1.Rows[i].Cells[7].Text.ToString().Trim() + "' ,'" + GridView1.Rows[i].Cells[8].Text.ToString().Trim() + "')"); A++;//导入成功 } } catch (Exception) { Response.Write("<script>alert('" + "ID:" + GridView1.Rows[i].Cells[0].Text.ToString().Trim() + " 失败!" + "');</script>"); } } conn.Close(); } catch { Response.Write("<script>alert('失败');</script>"); } Response.Write("<script>alert('成功导入:" + A + " 失败:" + (GridView1.Rows.Count - A - 1) + "');</script>"); if (cunzai.Length > 1) { Response.Write("<script>alert('添加失败 ID:" + cunzai.Substring(0, cunzai.Length - 1) + "');</script>"); } }
protected void ImageButton4_Click(object sender, ImageClickEventArgs e) { foreach (GridViewRow gr in GridView1.Rows) { CheckBox ch = (CheckBox)gr.FindControl("CheckBox1"); if (ch.Checked == true) { dataconn.eccom("delete from TaoTi where PaperID='" + GridView1.DataKeys[gr.RowIndex].Value + "'"); } } Response.Write("<script>alert('删除成功');</script>"); Response.Redirect("ManageTaoTi.aspx"); }
//提交专业 protected void Button1_Click(object sender, EventArgs e) { SqlDataReader read = db.ExceRead("select * from Major where Name='" + this.TextBox1.Text + "'"); read.Read(); if (read.HasRows) { if (this.TextBox1.Text == read["Name"].ToString()) { Response.Write("<script>alert('该专业已存在!')</script>"); Response.Write("<script>window.location.href='Major_add.aspx'</script>"); } } else if (TextBox1.Text == "") { Response.Write("<script>alert('请填写完整信息!')</script>"); Response.Write("<script>window.location.href='Major_add.aspx'</script>"); } else { db.eccom("insert into Major(Name) values ('" + this.TextBox1.Text + "')"); Response.Write("<script>alert('添加成功!')</script>"); Response.Write("<script>window.location.href='Major_add.aspx'</script>"); } read.Close(); }
protected void ImageButton1_Click(object sender, EventArgs e) { SqlDataReader read = db.ExceRead("select *from Teacher where id='" + this.TextBox1.Text + "'"); read.Read(); if (read.HasRows) { if (this.TextBox1.Text == read["id"].ToString()) { Response.Write("<script>alert('该用户已存在!')</script>"); Response.Write("<script>window.location.href='Teacher_add.aspx'</script>"); } } else if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "") { Response.Write("<script>alert('请填写完整信息!')</script>"); Response.Write("<script>window.location.href='Teacher_add.aspx'</script>"); } else { db.eccom("insert into Teacher(id,name,pwd,JoinTime,degree) values ('" + this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + this.TextBox3.Text + "' ,'" + DateTime.Now.ToString() + "','" + DropDownList1.SelectedItem + "')"); Response.Write("<script>alert('添加成功!')</script>"); Response.Write("<script>window.location.href='Teacher_add.aspx'</script>"); } read.Close(); }
protected void ImageButton1_Click(object sender, EventArgs e) { SqlDataReader read = db.ExceRead("select * from Admin where ID='" + this.TextBox1.Text + "'"); read.Read(); if (read.HasRows) { if (this.TextBox1.Text == read["ID"].ToString()) { Response.Write("<script>alert('该用户已存在!')</script>"); Response.Write("<script>window.location.href='admin_add.aspx'</script>"); } } else if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "") { Response.Write("<script>alert('请填写完整信息!')</script>"); Response.Write("<script>window.location.href='admin_add.aspx'</script>"); } else { db.eccom("insert into Admin(ID,Name,PWD,JoinTime) values ('" + this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + this.TextBox3.Text + "' ,'" + DateTime.Now.ToString() + "')"); Response.Write("<script>alert('添加成功!')</script>"); Response.Write("<script>window.location.href='admin_add.aspx'</script>"); } read.Close(); }
//=========================提交试卷=========================== protected void btnSubmit_Click(object sender, EventArgs e) { int_row1 = 0; //单选题题号索引 int_row2 = 0; //多选题题号索引 int_row1Point = 0; //单选题分数 int_row2Point = 0; //多选题分数 //try //{ Label3.Visible = Label4.Visible = Label7.Visible = Label8.Visible = Label9.Visible = Label10.Visible = true; this.lblStuID.Text = Session["StuName"].ToString(); this.lblSubject.Text = Session["SelLession"].ToString(); this.lblQuestion.Text = Session["SelTitle"].ToString(); this.getCom(3); this.getCom(4); this.lblTotal.Text = Convert.ToString(int_row1Point + int_row2Point); dataconn.eccom("insert into tb_StuResult" + "(stu_id,which_lesson,taotiid,taotiname,res_single,res_more)" + "values('" + lblStuID.Text + "','" + lblSubject.Text + "'," + Application["d2"].ToString() + ",'" + lblQuestion.Text + "'," + int_row1Point + "," + int_row2Point + ")"); this.getCom(5); Response.Write("<script lanuage=javascript>alert('您确定要交卷吗?');localtion='StartExamfra.aspx';</script>"); // this.btnSubmit.Enabled = false; //} //catch //{ // Response.Write("<script lanuage=javascript>alert('您已经答过该试卷');window.close()</script>"); //} }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { //调用公共类中的eccom方法,执行SQL语句 dataconn.eccom("delete from tb_TaoTi where ID='" + gvQueInfo.DataKeys[e.RowIndex].Value + "'"); //跳转后台套题管理页 Page.Response.Redirect("taoti_xinxi.aspx"); }
protected void Button3_Click(object sender, EventArgs e) { Label8.Visible = false; Label7.Visible = false; if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "") { Label8.Visible = true; } else { MySqlDataReader read = dataconn.ExceRead("select max(store_id) from store"); read.Read(); int a, c; c = int.Parse(TextBox2.Text); bool b; a = (int)read["max(store_id)"]; b = dataconn.eccom("insert into store(store_id,street,postcode,name,c_id)values(" + (a + 1) + ",'" + this.TextBox1.Text + "'," + c + ",'" + this.TextBox3.Text + "','" + DropDownList2.SelectedValue + "')"); if (b) { Label7.Visible = true; } Label7.Text = "Successful! The store ID is:" + (a + 1); } }
//======================修改管理员信息========================== protected void Button1_Click(object sender, EventArgs e) { string sqlstr = "update tb_Administrator set Name='" + this.txtAdminName.Text + "',PWD='" + this.txtAdminPwd.Text + "'where ID=" + Request["ID"]; dataconn.eccom(sqlstr); //Page.Response.Redirect("admin.aspx"); Response.Write("<script lanuage=javascript>alert('修改成功!');location='admin.aspx'</script>"); }
protected void Button1_Click(object sender, EventArgs e) { string getid = Request.QueryString["ID"].ToString(); dataconn.eccom("update tb_Lesson set Name='" + this.txtLessName.Text + "',ofProfession='" + ddlProfession.SelectedIndex + "' where ID='" + getid + "'"); Page.Response.Redirect("kecheng_xinxi.aspx"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { //定义SQL删除语句 string sqlstr3 = "delete from tb_Profession where ID='" + gvProInfo.DataKeys[e.RowIndex].Value.ToString() + "'"; //调用公共类ecom方法,执行SQL语句 dataconn.eccom(sqlstr3); //页面跳转 Page.Response.Redirect("zhuanye_xinxi.aspx"); }
//注册按钮 protected void Button1_Click(object sender, EventArgs e) { //调用公共类中的eccom,执行SQL语句命令 dataconn.eccom("insert into tb_Student" + "(ID,Name,PWD,question,answer,Sex,profession)" + "values('" + this.txtStuID.Text + "','" + this.txtStuName.Text + "','" + this.txtStuPwd.Text + "','" + this.txtQuePwd.Text + "','" + this.txtAnsPwd.Text + "','" + this.ddlSex.Text + "'," + Convert.ToInt32(ddlProfession.SelectedValue) + ")"); //如果添加成功,弹出成功对话框 Label1.Visible = true; }
protected void Button1_Click(object sender, EventArgs e) { try { string getid = Request.QueryString["ID"].ToString(); dataconn.eccom("update tb_TaoTi set name='" + this.txtQueName.Text + "',LessonID=" + Convert.ToInt32(ddlLesson.SelectedValue) + " where ID=" + getid + ""); Response.Write("<script lanuage=javascript>alert('修改成功!');location='taoti_xinxi.aspx'</script>"); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } }
protected void Button1_Click(object sender, EventArgs e) { if (this.txtAdminName.Text != "") { SqlConnection con = dataconn.getcon(); con.Open(); string sqlstr1 = "select count(*) from tb_Teacher where Name='" + txtAdminName.Text.ToString() + "'"; SqlCommand mycom = new SqlCommand(sqlstr1, con); int intcount = Convert.ToInt32(mycom.ExecuteScalar()); if (intcount > 0) { Response.Write("<script>alert('对不起!此教师已经添加!');location='teacherInsert.aspx'</script>"); } else { dataconn.eccom("exec add_teacher '" + txtAdminName.Text + "','" + txtAdminPwd.Text + "'"); Response.Write("<script lanuage=javascript>alert('添加成功!');location='Teacher.aspx'</script>"); } } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { SqlDataReader read = db.ExceRead("select * from Course where c_name='" + this.TextBox2.Text + "'"); read.Read(); if (read.HasRows) { if (this.TextBox2.Text == read["c_name"].ToString()) { Response.Write("<script>alert('该用户已存在!')</script>"); Response.Write("<script>window.location.href='AddCourse.aspx'</script>"); } } else { db.eccom("insert into Course(c_name,c_date,teacher_id) values ('" + this.TextBox2.Text + "','" + DateTime.Now.ToString() + "','" + Session["ID"].ToString() + "')"); Response.Write("<script>alert('添加成功!')</script>"); Response.Write("<script>window.location.href='AddCourse.aspx'</script>"); } read.Close(); }
protected void Button1_Click(object sender, EventArgs e) { if (this.txtAdminName.Text != "") { SqlConnection con = dataconn.getcon(); con.Open(); string sqlstr1 = "select count(*) from tb_Administrator where Name='" + txtAdminName.Text.ToString() + "'"; SqlCommand mycom = new SqlCommand(sqlstr1, con); int intcount = Convert.ToInt32(mycom.ExecuteScalar()); if (intcount > 0) { Response.Write("<script>alert('对不起!此管理员已经添加!');location='AdminInsert.aspx'</script>"); } else { dataconn.eccom("insert into tb_Administrator(Name,PWD)values('" + txtAdminName.Text + "','" + txtAdminPwd.Text + "')"); //Page.Response.Redirect("admin.aspx"); Response.Write("<script lanuage=javascript>alert('添加成功!');location='admin.aspx'</script>"); } } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { SqlDataReader read = dataconn.ExceRead("select *from Student where ID='" + this.txtStuID.Text + "'"); read.Read(); if (read.HasRows) { if (this.txtStuID.Text == read["ID"].ToString()) { Response.Write("<script>alert('该用户已存在!')</script>"); Response.Write("<script>window.location.href='AddStudent.aspx'</script>"); } } else { dataconn.eccom("insert into Student(ID,Name,PWD,Sex,JoinTime,Question,Answer,profession) values ('" + this.txtStuID.Text + "','" + this.txtStuName.Text + "','" + this.txtStuPwd.Text + "' ,'" + Request["DropDownList1"] + "','" + DateTime.Now.ToString() + "','" + Request["DropDownList3"] + "','" + this.txtAnsPwd.Text + "','" + Request["ddlProfession"] + "')"); Session["ID"] = txtStuID.Text; Session["PWD"] = txtStuPwd.Text; Response.Write("<script>alert('添加成功!')</script>"); Response.Write("<script>window.location.href='AddStudent.aspx'</script>"); } read.Close(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { dataconn.eccom("delete from tb_Student where ID='" + gvStuInfo.DataKeys[e.RowIndex].Value + "'"); Page.Response.Redirect("zhuce_stu.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { dataconn.eccom("insert into tb_Profession(Name)values('" + txtProName.Text + "')"); //Response.Write("<script lanuage=javascript>alert('添加成功!');location='zhuanye_xinxi.aspx'</script>"); Page.Response.Redirect("zhuanye_xinxi.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { dataconn.eccom("update tb_Profession set Name='" + this.txtProName.Text + "' where ID=" + Request["ID"]); Page.Response.Redirect("zhuanye_xinxi.aspx"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { dataconn.eccom("delete from tb_lesson where ID='" + gvLessInfo.DataKeys[e.RowIndex].Value + "'"); Page.Response.Redirect("kecheng_xinxi.aspx"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { dataconn.eccom("delete from Course where c_name='" + GridView1.DataKeys[e.RowIndex].Value + "'"); Response.Redirect("ManageCourse.aspx"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { //调用公共类中的eccom方法,删除管理员信息 dataconn.eccom("delete from tb_Teacher where ID='" + gvAdminInfo.DataKeys[e.RowIndex].Value + "'"); Page.Response.Redirect("teacher.aspx"); }
protected void btnAdd_Click(object sender, EventArgs e) { string sstr1 = Session["drop1"].ToString(); string sstr2 = Session["drop2"].ToString(); string sstr3 = Session["drop3"].ToString(); if (ddlType.SelectedIndex == 0) { /* * dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + ddlAnswer.Text + "','" + txtInstruction.Text + "')"); */ //用存储过程插入题目 dataconn.eccom("exec add_questions '" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + ddlAnswer.Text + "','" + txtInstruction.Text + "'"); //Response.Write("<script lanuage=javascript>alert('添加成功!');location='kaoshi_timu.aspx'</script>"); Response.Redirect("kaoshi_timu.aspx"); } else { if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == true) { string str1 = "A,B,C,D"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str1 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == false) { string str2 = "A,B,C"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str2 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == false) { string str3 = "A,B"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str3 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == false) { string str4 = "A"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str4 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == false) { string str5 = "B"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str5 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == false) { string str6 = "B,C"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str6 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == true) { string str7 = "B,D"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str7 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == true) { string str8 = ",B,C,D"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str8 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == true) { string str9 = "A,D"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str9 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == true) { string str10 = "C,D"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str10 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == false) { string str11 = "A,C"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str11 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == false) { string str12 = "B,D"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str12 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == true) { string str13 = "A,B,D"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str13 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == true) { string str14 = "A,C"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str14 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == false) { string str15 = "C"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str15 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == true) { string str16 = "D"; dataconn.eccom("insert into tb_Questions" + "(que_professionid,que_lessonid,que_taotiid,que_subject,que_type,optionA,optionB,optionC,optionD,que_answer,note)" + "values('" + sstr1 + "','" + sstr2 + "','" + sstr3 + "','" + this.txtExamTitle.Text + "','" + ddlType.Text + "','" + this.txtExamA.Text + "','" + this.txtExamB.Text + "','" + this.txtExamC.Text + "','" + this.txtExamD.Text + "','" + str16 + "','" + txtInstruction.Text + "')"); Response.Redirect("kaoshi_timu.aspx"); } } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { //调用公共类中的eccom方法,执行SQL语句 dataconn.eccom("delete from tb_StuResult where res_id='" + gvStuExam.DataKeys[e.RowIndex].Value + "'"); Page.Response.Redirect("kaosheng_chengji.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { if (ddlAnswer.Visible == true && cblAnswer.Visible == false && ddlProfession.SelectedIndex == 0) { dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + ddlAnswer.Text + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); //Response.Redirect("kaoshi_timu.aspx"); } else { if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == true) { string str1 = "A,B,C,D"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str1 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); //Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == false) { string str2 = "A,B,C"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str2 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); //Response.Redirect("kaoshi_timu.aspx"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == false) { string str3 = "A,B"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str3 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == false) { string str4 = "A"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str4 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == false) { string str5 = "B"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str5 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == false) { string str6 = "B,C"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str6 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == true) { string str7 = "B,D"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str7 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == true) { string str8 = "B,C,D"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str8 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == true) { string str9 = "A,D"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str9 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == true) { string str10 = "C,D"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str10 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == false) { string str11 = "A,C"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str11 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == false) { string str12 = "B,D"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str12 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == true && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == true) { string str13 = "A,B,D"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str13 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == true && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == true) { string str14 = "A,C"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str14 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == true && cblAnswer.Items[3].Selected == false) { string str15 = "C"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str15 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } if (cblAnswer.Items[0].Selected == false && cblAnswer.Items[1].Selected == false && cblAnswer.Items[2].Selected == false && cblAnswer.Items[3].Selected == true) { string str16 = "D"; dataconn.eccom("update tb_Questions set que_subject='" + this.txtLessName.Text + "',que_type='" + ddlProfession.Text + "',optionA='" + this.txtSelA.Text + "',optionB='" + this.txtSelB.Text + "',optionC='" + this.txtSelC.Text + "',optionD='" + this.txtSelD.Text + "',que_answer='" + str16 + "',note='" + txtInstruction.Text + "' where id=" + Request["id"]); Response.Write("<script lanuage=javascript>alert('修改成功!');location='kaoshi_timu.aspx'</script>"); } } }
protected void gvQueInfo_RowDeleting(object sender, GridViewDeleteEventArgs e) { dataconn.eccom("delete from JudgeProblem where ID='" + gvQueInfo.DataKeys[e.RowIndex].Value + "'"); Response.Redirect("ManagePanDuan.aspx"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { dataconn.eccom("delete from Teacher where id='" + GridView1.DataKeys[e.RowIndex].Value + "'"); Response.Redirect("TeacherADD.aspx"); }
protected void Button_preview_Click(object sender, EventArgs e) { db.eccom("insert into JudgeProblem(c_id,Title,Answer,Grade) values('" + Request["ddlCourse"] + "','" + this.txtTitle.Text + "','" + rblAnswer.SelectedValue + "','" + Request["DropDownList3"] + "','" + Request["DropDownList5"] + "')"); Response.Write("<script>alert('添加成功!')</script>"); }