protected void Button2_Click(object sender, EventArgs e)
    {
        studentBLL StudentBLL = new studentBLL();
        examrecordBLL ExamRecordBLL = new examrecordBLL();
        studentloginlogBLL StudentLoginLogBLL = new studentloginlogBLL();

        try
        {
            ExamRecordBLL.Delete(Session["StuId"].ToString().Trim());
            StudentLoginLogBLL.Delete(Session["StuId"].ToString().Trim());
            StudentBLL.Delete(id);
        }
        catch
        {

            MessageBox.Show(this, "删除失败!");
        }
        MessageBox.ShowAndRedirect(this, "删除成功!", "student.aspx");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        examrecordBLL ExamRecordBLL = new examrecordBLL();
        classdetailBLL ClassDetailBLL = new classdetailBLL();
        try
        {
            ExamRecordBLL.Delete(Convert.ToInt32(Request.QueryString["id"].ToString().Trim()), "1");
            ClassDetailBLL.Delete(Convert.ToInt32(Request.QueryString["id"].ToString().Trim()));
        }

        catch
        {
            MessageBox.Show(this, "删除失败!");
        }
        MessageBox.ShowAndRedirect(this, "删除成功!", "class.aspx");
    }
 protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     examrecordBLL ExamRecordBLL = new examrecordBLL();
     MessageBox.Show(this, "确定删除!");
     try
     {
         if (ExamRecordBLL.Delete(Convert.ToInt32(GridView2.DataKeys[e.RowIndex].Value))) MessageBox.Show(this, "删除成功!");
         else MessageBox.Show(this, "删除失败!");
     }
     catch
     {
         MessageBox.Show(this, "删除失败!");
     }
     GV2DataBind();
 }