📄 st_grade_manage.aspx.cs
字号:
{
st_comm.ExecuteNonQuery();
st_lbl_note.Text = "编辑成功";
st_dtg_grade.EditItemIndex = -1;
}
catch (SqlException)
{
st_lbl_note.Text = "编辑失败";
st_lbl_note.Style["color"] = "red";
}
st_comm.Connection.Close();
ST_BindGrid();
}
public void DataGrid_delete(object sender, DataGridCommandEventArgs e)
{
string st_sqlstr = "delete from ST_student_course where ST_ID=@id";
SqlCommand st_comm = new SqlCommand(st_sqlstr, st_conn);
st_comm.Parameters.Add(new SqlParameter("@id", SqlDbType.Char, 10));
st_comm.Parameters["@id"].Value = st_dtg_grade.DataKeys[(int)e.Item.ItemIndex];
st_comm.Connection.Open();
try
{
st_comm.ExecuteNonQuery();
st_lbl_note.Text = "删除成功";
}
catch (SqlException)
{
st_lbl_note.Text = "删除失败";
st_lbl_note.Style["color"] = "red";
}
st_comm.Connection.Close();
ST_BindGrid();
}
protected void st_btn_count_Click(object sender, System.EventArgs e)
{
if (st_ddl_stat.SelectedItem.Value == "系别")
{
if (st_ddl_content.SelectedItem.Text == "总人数")
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_department='" + st_tbx_area.Text + "' ";
}
else if (st_ddl_content.SelectedItem.Text == "优秀人数")
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_department='" + st_tbx_area.Text + "'and ST_Student_grade>=85 ";
}
else if (st_ddl_content.SelectedItem.Text == "不及格人数")
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_department='" + st_tbx_area.Text + "'and ST_Student_grade<60 ";
}
else
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade) from ST_student_course,ST_student,ST_class where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=class.ST_Class_id and ST_class.ST_Class_department='" + st_tbx_area.Text + "' ";
}
}
else if (st_ddl_stat.SelectedItem.Value == "学院")
{
if (st_ddl_content.SelectedItem.Text == "总人数")
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_college='" + st_tbx_area.Text + "' ";
}
else if (st_ddl_content.SelectedItem.Text == "优秀人数")
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_college='" + st_tbx_area.Text + "'and ST_Student_grade>=85 ";
}
else if (st_ddl_content.SelectedItem.Text == "不及格人数")
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_college='" + st_tbx_area.Text + "'and ST_Student_grade<60 ";
}
else
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade) from ST_student_course,ST_student,ST_class where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_college='" + st_tbx_area.Text + "' ";
}
}
else if (st_ddl_stat.SelectedItem.Value == "班级")
{
if (st_ddl_content.SelectedItem.Text == "总人数")
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "' and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid='" + st_tbx_area.Text + "'";
}
else if (st_ddl_content.SelectedItem.Text == "优秀人数")
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "' and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid='" + st_tbx_area.Text + "'and ST_Student_grade>=85";
}
else if (st_ddl_content.SelectedItem.Text == "不及格人数")
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "' and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid='" + st_tbx_area.Text + "'and ST_Student_grade<60";
}
else
{
st_sqlstr = "select AVG(ST_Student_grade),MAX(ST_Student_grade) from ST_student_course,ST_student where ST_Course_id='" + st_tbx_classid.Text + "' and ST_student_course.ST_Course_year='" + st_tbx_year.Text + "' and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid='" + st_tbx_area.Text + "'";
}
}
SqlCommand st_comm = new SqlCommand(st_sqlstr, st_conn);
st_conn.Open();
SqlDataReader dr = st_comm.ExecuteReader();
if (dr.Read())
{
if (st_ddl_content.SelectedItem.Text == "平均分")
{
st_lbl_average.Visible = true;
st_lbl_average.Text = "平均分为:" + dr[0].ToString();
}
else if (st_ddl_content.SelectedItem.Text == "最高分")
{
st_lbl_high.Visible = true;
st_lbl_high.Text = "最高分为:" + dr[1].ToString();
}
else if (st_ddl_content.SelectedItem.Text == "总人数")
{
st_lbl_all.Visible = true;
st_lbl_all.Text = "总人数为:" + dr[2].ToString();
}
else if (st_ddl_content.SelectedItem.Text == "优秀人数")
{
st_lbl_a.Visible = true;
st_lbl_a.Text = "优秀人数为:" + dr[2].ToString();
}
else if (st_ddl_content.SelectedItem.Text == "不及格人数")
{
st_lbl_unpass.Visible = true;
st_lbl_unpass.Text = "不及格人数为:" + dr[2].ToString();
}
else
{
st_lbl_note.Text = "无此信息";
}
st_conn.Close();
}
}
protected void st_lbtn_addgrade_Click(object sender, EventArgs e)
{
Response.Redirect("ST_addgrade.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -