ASP.NET学生信息管理系统

摘 要

    本文介绍了在ASP.net环境下采用“自上而下地总体规划,自下而上地应用开发”的策略开发一个管理信息系统的过程。通过分析某一学校学生管理的不足,创建了一套行之有效的计算机管理学生的方案。文章介绍了学生管理信息系统的系统分析部分,包括可行性分析、业务流程分析等;系统设计部分主要介绍了系统功能设计和数据库设计及代码设计;系统实现部分说明了几个主要模块的算法,   本系统界面友好,操作简单,比较实用。

【关键字】:管理信息系统、学生管理、ASP.net应用

3.3系统功能模块分析

SMS主要的功能包括以下几个方面:用户管理(管理员,老师管理和学生管理),课程管理,班级管理,成绩管理选课管理。设计图如5--3所示,除此之外,系统还包含了教师管理,班级管理等辅助功能模块,用于协调4个主模块。

用户管理模块:该模块由两个子模块构成,分别示管理员与教师管理模块和学生管理模块。主要负责管理员与教师以及学生信息的管理功能,具体参看管理员与教师管理子模块和学生管理子模块的模块功能描述。

管理员与教师管理子模块:该模块主要负责管理系统管理员的信息。它为用户管理模块的一个子模块。主要功能是将本校的教师权限设为管理员。管理员课添加新教师信息,每个教师有唯一的编号,之后通过把教师加为管理员,而令此教师具有管理员的权限,从而教师可以登陆系统进行管理员的相关操作。

学生管理子模块:该模块主要负责管理所有在校注册学生的个人信息。它为用户管理模块的一个子模块。主要功能包括添加,删除,修改,查找学生信息。每个学生有唯一的学号,管理员添加新生后,新生即可登陆此系统浏览个人信息,登陆此系统的用户名和密码默认都是此学生的学号。

课程管理模块:该模块负责管理本校所有的课程信息。主要功能包括添加,删除,修改,查找课程信息。只有管理员才具有对课程信息进行维护的权限,课程的类型分三种:公共课,专业课和选修课。课程管理模块是选课管理模块的基础,只有在课程管理中添有选修课的信息,学生才能进行选课。

选课管理模块:该模块负责选课的管理。主要功能包括删除,统计学生选课信息。它以在课程管理系统中维护号的信息作为基础,既可以对选修课程进行管理,也可以对统计选课人数,并根据学生选课时间先后决定最终选修此课的同学。

成绩管理模块:学生学的每一门课显然最后要有成绩,查询的内肉包括课程名称,学分,成绩等。只有管理员可以录入学生每一门课的成绩,并能进行修改,学生只能查询自己所学课程的成绩,并且可以查询每一学期学生所学课程所获总学分,前提是成绩必须及格,否则将没有此课的成绩。

班级管理模块:该模块负责班级的管理。主要功能包括添加,删除和修改班级信息,以及对班级信息的查询。只有管理员才具有对班级管理信息进行维护的权限。学生信息的添加是建立在班级信息维护的基础上,每个学生必然属于特定的班级。并且在管理员对学生成绩查询统计时,可以统计各个班级的平均分,最高分。

8.1学生管理系统首页

学生管理系统首页具有自动导航功能,不同用户登陆时将根据不同的身份进入不同的系统功能页。

代码入下

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Configuration;

namespace sms

{

    public class _default : System.Web.UI.Page

    {

         protected System.Web.UI.WebControls.TextBox Tbx_userid;

         protected System.Web.UI.WebControls.TextBox Tbx_userpwd;

         protected System.Web.UI.WebControls.Label Lbl_note;

         protected System.Web.UI.WebControls.Button Btn_enter;

         private void Page_Load(object sender, System.EventArgs e)

         {

             // 在此处放置用户代码以初始化页面

         }

         #region Web Form Designer generated code

         override protected void OnInit(EventArgs e)

         {

             //

             // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。

             //

             InitializeComponent();

             base.OnInit(e);

         }

         private void InitializeComponent()

         {   

             this.Btn_enter.Click += new System.EventHandler(this.Btn_enter_Click);

             this.Load += new System.EventHandler(this.Page_Load);

         }

         #endregion

         private void Btn_enter_Click(object sender, System.EventArgs e)

         {

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             SqlConnection cn=new SqlConnection(strconn); 

             cn.Open();

             string strsql="select * from users where User_id='"+Tbx_userid.Text+"'and User_password='"+Tbx_userpwd.Text+"'";

             SqlCommand cm=new SqlCommand(strsql,cn);

             SqlDataReader dr=cm.ExecuteReader();

             if(dr.Read())

             {   Session["User_id"]=dr["User_id"];

                  Session["user_power"]=dr["User_power"];          

                  if((int)Session["User_power"]==0)

                  {

                      Response.Redirect("query.aspx");

                  }

                  else

                  {

                      Response.Redirect("student.aspx");

                  }

             }

             else

             {

                      Lbl_note.Text="对不起,登陆失败!";

               }

             cn.Close();

         }

        

    }

}

8.2学生信息维护页面

  学生信息维护模块时SMS重管理学生学籍的部分。页面采用DataGrid控件的Dgd_student与DataSet数据集的绑定返回所有学生信息,可以对学生信息进行修改和删除。

代码如下:

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Configuration;

namespace sms

{

    /// <summary>

    /// student 的摘要说明。

    /// </summary>

    public class student : System.Web.UI.Page

    {

         protected System.Web.UI.WebControls.LinkButton Lbtn_course;

         protected System.Web.UI.WebControls.LinkButton Lbtn_sortcourse;

         protected System.Web.UI.WebControls.DataGrid Dgd_student;

         protected System.Web.UI.WebControls.Button Btn_all;

         protected System.Web.UI.WebControls.Panel Pnl_sort;

         protected System.Web.UI.WebControls.TextBox Tbx_sortid;

         protected System.Web.UI.WebControls.Button Btn_ok;

         SqlConnection cn;

         protected System.Web.UI.WebControls.Button Btn_search;

         protected System.Web.UI.WebControls.Label Lbl_note;

         protected System.Web.UI.WebControls.LinkButton Lbtn_add;

         protected System.Web.UI.WebControls.TextBox Tbx_name;

         protected System.Web.UI.WebControls.Button Btn_exit;

         protected System.Web.UI.WebControls.LinkButton Lbtn_grade;

         protected System.Web.UI.WebControls.LinkButton Lbtn_addclass;

         protected System.Web.UI.WebControls.LinkButton Lbtn_addteacher;

         protected System.Web.UI.WebControls.LinkButton Lbtn_student;

         string strsql;

         private void Page_Load(object sender, System.EventArgs e)

         {

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             cn=new SqlConnection(strconn); 

             if(!IsPostBack)

             Bindgrid();

         }

         #region Web Form Designer generated code

         override protected void OnInit(EventArgs e)

         {

             InitializeComponent();

             base.OnInit(e);

         }

        

         private void InitializeComponent()

         {   

             this.Lbtn_addclass.Click += new System.EventHandler(this.Lbtn_addclass_Click);

             this.Lbtn_addteacher.Click += new System.EventHandler(this.Lbtn_addteacher_Click);

             this.Lbtn_course.Click += new System.EventHandler(this.Lbtn_course_Click);

             this.Lbtn_sortcourse.Click += new System.EventHandler(this.Lbtn_sortcourse_Click);

             this.Lbtn_grade.Click += new System.EventHandler(this.Lbtn_grade_Click);

             this.Btn_search.Click += new System.EventHandler(this.Btn_search_Click);

             this.Btn_ok.Click += new System.EventHandler(this.Btn_ok_Click);

             this.Lbtn_add.Click += new System.EventHandler(this.Lbtn_add_Click);

             this.Btn_all.Click += new System.EventHandler(this.Btn_all_Click);

             this.Btn_exit.Click += new System.EventHandler(this.Btn_exit_Click);

             this.Load += new System.EventHandler(this.Page_Load);

         }

         #endregion

         private void Btn_search_Click(object sender, System.EventArgs e)

         { 

             Pnl_sort.Visible=true;

         }

         private void Btn_all_Click(object sender, System.EventArgs e)

         { 

            

             Pnl_sort.Visible=false;

             Bindgrid();

            

    }

         public void DataGrid_Page(object sender,DataGridPageChangedEventArgs e)

         {

             Dgd_student.CurrentPageIndex=e.NewPageIndex;

             Bindgrid();

         }

         public void DataGrid_cancel(object sender,DataGridCommandEventArgs e)

         {

            

             Dgd_student.EditItemIndex=-1;

             Bindgrid();

            

         }

         public void DataGrid_edit(object sender,DataGridCommandEventArgs e)

         {

            

                  Dgd_student.EditItemIndex=(int)e.Item.ItemIndex;

        

                  Bindgrid();

            

         }

         public void DataGrid_update(object sender,DataGridCommandEventArgs e)

         {

             string strsql="update student set Student_name=@Student_name,Student_sex=@Student_sex,Student_nation=@Student_nation,Student_birthday=@Student_birthday,Student_time=@Student_time,Student_classid=@Student_classid,Student_home=@Student_home,Student_else=@Student_else where Student_id=@Student_id";

             SqlCommand cm=new SqlCommand(strsql,cn);

             try

             {

             cm.Parameters.Add(new SqlParameter("@Student_name",SqlDbType.VarChar,50));

             cm.Parameters.Add(new SqlParameter("@Student_sex",SqlDbType.Char,10));

             cm.Parameters.Add(new SqlParameter("@Student_nation",SqlDbType.Char,10));

             cm.Parameters.Add(new SqlParameter("@Student_birthday",SqlDbType.DateTime,8));

             cm.Parameters.Add(new SqlParameter("@Student_time",SqlDbType.DateTime,8));

             cm.Parameters.Add(new SqlParameter("@Student_classid",SqlDbType.VarChar,50));

             cm.Parameters.Add(new SqlParameter("@Student_home",SqlDbType.VarChar,50));

             cm.Parameters.Add(new SqlParameter("@Student_else",SqlDbType.VarChar,50));

             cm.Parameters.Add(new SqlParameter("@Student_id",SqlDbType.VarChar,50));

             string colvalue=((TextBox)e.Item.Cells[1].Controls[0]).Text;

             cm.Parameters["@Student_name"].Value=colvalue;

             colvalue=((TextBox)e.Item.Cells[2].Controls[0]).Text;

             cm.Parameters["@Student_sex"].Value=colvalue;

             colvalue=((TextBox)e.Item.Cells[3].Controls[0]).Text;

             cm.Parameters["@Student_nation"].Value=colvalue;

         colvalue=((TextBox)e.Item.Cells[4].Controls[0]).Text;

             cm.Parameters["@Student_birthday"].Value=colvalue;

             colvalue=((TextBox)e.Item.Cells[5].Controls[0]).Text;

             cm.Parameters["@Student_time"].Value=colvalue;

             colvalue=((TextBox)e.Item.Cells[6].Controls[0]).Text;

             cm.Parameters["@Student_classid"].Value=colvalue;

             colvalue=((TextBox)e.Item.Cells[7].Controls[0]).Text;

             cm.Parameters["@Student_home"].Value=colvalue;

             colvalue=((TextBox)e.Item.Cells[8].Controls[0]).Text;

             cm.Parameters["@Student_else"].Value=colvalue;        

             cm.Parameters["@Student_id"].Value=Dgd_student.DataKeys[(int)e.Item.ItemIndex];

             cm.Connection.Open();          

                  cm.ExecuteNonQuery();

                  Lbl_note.Text="编辑成功";

                  Dgd_student.EditItemIndex=-1;

             }

             catch

             {

                  Lbl_note.Text="编辑失败,请检查输入!";

                  Lbl_note.Style["color"]="red";

             }

             cm.Connection.Close();    

             Bindgrid();

            

         }

                  public void DataGrid_delete(object sender,DataGridCommandEventArgs e)

         {

            

             string strsql="delete from student where Student_id=@userid";

             SqlCommand cm=new SqlCommand(strsql,cn);

             cm.Parameters.Add(new SqlParameter("@userid",SqlDbType.VarChar,50));

             cm.Parameters["@userid"].Value=Dgd_student.DataKeys[(int)e.Item.ItemIndex];

             cm.Connection.Open();

             try

             {

                  cm.ExecuteNonQuery();

                  Lbl_note.Text="删除成功";

                 

             }

             catch(SqlException)

             {

                  Lbl_note.Text="删除失败";

                  Lbl_note.Style["color"]="red";

             }

             cm.Connection.Close();         

             Bindgrid();

         }

         public void Bindgrid()

         {    strsql="select * from student";

             SqlDataAdapter da=new SqlDataAdapter(strsql,cn);

             DataSet ds=new DataSet();

             da.Fill(ds);

             Dgd_student.DataSource=ds;

             Dgd_student.DataBind();

         }                

         private void Btn_ok_Click(object sender, System.EventArgs e)

         { 

            

             strsql="select * from student  where Student_id='"+Tbx_sortid.Text+"'or Student_name='"+Tbx_name.Text+"'";

             SqlDataAdapter da=new SqlDataAdapter(strsql,cn);

             DataSet ds=new DataSet();

             da.Fill(ds);

             Dgd_student.DataSource=ds;

             Dgd_student.DataBind();

         }

         private void Lbtn_course_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("course.aspx");

         }

         private void Lbtn_sortcourse_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("student_course.aspx");

         }

         private void Lbtn_add_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("addstudent.aspx");

         }

         private void Btn_exit_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("default.aspx");

         }

         private void Lbtn_grade_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("grade_manage.aspx");

         }

         private void Lbtn_addclass_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("classes.aspx");

         }

         private void Lbtn_addteacher_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("teacher.aspx");

         }

         private void Lbtn_student_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("student.aspx");

         }

    }

}

8.3学生信息添加页面

学生信息添加页面主要负责往数据库里添加数据。后台支持事件主要为Btn_ok_Click()事件负责当用户单击“确定”按钮后的数据库添加操作。利用RequiredFieldValidator控件可以用来验证用户输入信息是否为空。若输入学号存在,利用CustomValidator验证控件,触发ServerValidator事件,判断是否存在此学号的学生。“重置”按钮的click事件将完成刷新此页面的功能。

代码如下:

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Configuration;

namespace sms

{

    /// <summary>

    /// addstudent 的摘要说明。

    /// </summary>

    public class addstudent : System.Web.UI.Page

    {

         protected System.Web.UI.WebControls.TextBox Tbx_id;

         protected System.Web.UI.WebControls.TextBox Tbx_name;

         protected System.Web.UI.WebControls.TextBox Tbx_nation;

         protected System.Web.UI.WebControls.TextBox Tbx_birthday;

         protected System.Web.UI.WebControls.TextBox Tbx_time;

         protected System.Web.UI.WebControls.TextBox Tbx_home;

         protected System.Web.UI.WebControls.TextBox Tbx_else;

         protected System.Web.UI.WebControls.DropDownList Ddl_sex;

         protected System.Web.UI.WebControls.Button Btn_ok;

         protected System.Web.UI.WebControls.CustomValidator Cv_id;

         protected System.Web.UI.WebControls.Label Lbl_note;

         protected System.Web.UI.WebControls.Button Btn_reset;

         protected System.Web.UI.WebControls.RequiredFieldValidator Rfv_name;

         protected System.Web.UI.WebControls.RequiredFieldValidator Rfv_id;

         protected System.Web.UI.WebControls.RequiredFieldValidator Rfv_nation;

         protected System.Web.UI.WebControls.RequiredFieldValidator Rfv_birthday;

         protected System.Web.UI.WebControls.RequiredFieldValidator Rfv_time;

         protected System.Web.UI.WebControls.RequiredFieldValidator Rfv_class;

         protected System.Web.UI.WebControls.RequiredFieldValidator Rfv_home;

         protected System.Web.UI.WebControls.DropDownList Ddl_class;

        SqlConnection cn;

         private void Page_Load(object sender, System.EventArgs e)

         {//班级名称下拉列表框绑定

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             SqlConnection cn0=new SqlConnection(strconn);

             if(!IsPostBack)

             {

                  cn0.Open ();

                  string mysql="select * from class";

                  SqlCommand cm1=new SqlCommand  (mysql,cn0);

                  SqlDataReader dr1=cm1.ExecuteReader ();

                  while(dr1.Read ())

                  {

                      Ddl_class.Items .Add (new ListItem(dr1["Class_name"].ToString() ,dr1["Class_id"].ToString()) );

                  }

                  cn0.Close ();

             }

             // 在此处放置用户代码以初始化页面

             cn=new SqlConnection(strconn); 

         }

         #region Web Form Designer generated code

         override protected void OnInit(EventArgs e)

         {

             //

             // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。

             //

             InitializeComponent();

             base.OnInit(e);

         }

        

        private void InitializeComponent()

         {   

             this.Cv_id.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Cv_id_ServerValidate);

             this.Btn_ok.Click += new System.EventHandler(this.Btn_ok_Click);

             this.Btn_reset.Click += new System.EventHandler(this.Btn_reset_Click);

             this.Load += new System.EventHandler(this.Page_Load);

         }

         #endregion

         private void Btn_ok_Click(object sender, System.EventArgs e)

         {

            

             SqlCommand cm=new SqlCommand("insert_student_1",cn);

             cm.CommandType=CommandType.StoredProcedure;

             try

             {

             cm.Parameters.Add(new SqlParameter("@Student_id",SqlDbType.VarChar,50));

             cm.Parameters["@Student_id"].Value=Tbx_id.Text;

             cm.Parameters.Add(new SqlParameter("@Student_name",SqlDbType.VarChar,50));

             cm.Parameters["@Student_name"].Value=Tbx_name.Text;

             cm.Parameters.Add(new SqlParameter("@Student_sex",SqlDbType.Char,10));

             cm.Parameters["@Student_sex"].Value=Ddl_sex.SelectedItem.Value;

             cm.Parameters.Add(new SqlParameter("@Student_nation",SqlDbType.Char,10));

             cm.Parameters["@Student_nation"].Value=Tbx_nation.Text;

             cm.Parameters.Add(new SqlParameter("@Student_birthday",SqlDbType.DateTime,8));

             cm.Parameters["@Student_birthday"].Value=Tbx_birthday.Text;

             cm.Parameters.Add(new SqlParameter("@Student_time",SqlDbType.DateTime,8));

             cm.Parameters["@Student_time"].Value=Tbx_time.Text;

             cm.Parameters.Add(new SqlParameter("@Student_classid",SqlDbType.VarChar,50));

             cm.Parameters["@Student_classid"].Value=Ddl_class.SelectedItem.Value;

             cm.Parameters.Add(new SqlParameter("@Student_home",SqlDbType.VarChar,50));

             cm.Parameters["@Student_home"].Value=Tbx_home.Text;

             cm.Parameters.Add(new SqlParameter("@Student_else",SqlDbType.VarChar,50));

             cm.Parameters["@Student_else"].Value=Tbx_else.Text;

             cm.Connection.Open();

             cm.ExecuteNonQuery();

             cm.Connection.Close();

             insert();

             }

             catch

             {

                  Lbl_note.Text="添加失败,请检查输入!";

                  Lbl_note.Style["color"]="red";

             }

         }

             public void insert()

             {

             string strsl="insert into users(User_id,User_password,User_power) values(@User_id,@User_pwd,0)";

             SqlCommand cm=new SqlCommand(strsl,cn);

             cm.Parameters.Add(new SqlParameter("@User_id",SqlDbType.VarChar,50));

             cm.Parameters["@User_id"].Value=Tbx_id.Text;

             cm.Parameters.Add(new SqlParameter("@User_pwd",SqlDbType.VarChar,50));

             cm.Parameters["@User_pwd"].Value=Tbx_id.Text;

             cm.Connection.Open();

                  try

                  {

                      cm.ExecuteNonQuery();

                      Response.Redirect("student.aspx");

                  }

                  catch(SqlException)

                  {

                      Lbl_note.Text="添加失败";

                      Lbl_note.Style["color"]="red";

                  }

             cm.Connection.Close();

         }

         private void Btn_reset_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("addstudent.aspx");

         }

         private void Cv_id_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)

         {

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             cn=new SqlConnection(strconn);

             cn.Open();

             SqlCommand cm=new SqlCommand("select_student_1",cn);

             cm.CommandType=CommandType.StoredProcedure;

             cm.Parameters.Add("@Student_id",SqlDbType.VarChar,50);

             cm.Parameters["@Student_id"].Value=Tbx_id.Text;

             SqlDataReader dr=cm.ExecuteReader();

             if(dr.Read())

             {

                  args.IsValid=false;

             }

             else

             {

                  args.IsValid=true;

             }

             cn.Close();

         }

    }

}

8.4课程信息管理页面

课程信息管理页面与学生信息维护页面非常相似,进行DataGrid控件Dgd-course的绑定操作,管理员可以在此页面进行课程信息的编辑和删除。

主要相关代码如下:

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Configuration;

namespace sms

{

    /// <summary>

    /// course 的摘要说明。

    /// </summary>

    public class course : System.Web.UI.Page

    {

        SqlConnection cn;

         protected System.Web.UI.WebControls.TextBox Tbx_name;

         protected System.Web.UI.WebControls.TextBox Tbx_id;

         protected System.Web.UI.WebControls.Button Btn_search;

         protected System.Web.UI.WebControls.DataGrid Dgd_course;

         protected System.Web.UI.WebControls.Label Lbl_note;

         protected System.Web.UI.WebControls.Button Btn_exit;

         string strsql;

         private void Page_Load(object sender, System.EventArgs e)

         {

             // 在此处放置用户代码以初始化页面

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             cn=new SqlConnection(strconn); 

             if(!IsPostBack)

                  Bindgrid();

         }

         #region Web Form Designer generated code

         override protected void OnInit(EventArgs e)

         {

             //

             // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。

             //

             InitializeComponent();

             base.OnInit(e);

         }

        

         /// <summary>

         /// 设计器支持所需的方法 - 不要使用代码编辑器修改

         /// 此方法的内容。

         /// </summary>

         private void InitializeComponent()

         {   

             this.Btn_search.Click += new System.EventHandler(this.Btn_search_Click);

             this.Btn_exit.Click += new System.EventHandler(this.Btn_exit_Click);

             this.Load += new System.EventHandler(this.Page_Load);

         }

         #endregion

         public void DataGrid_Page(object sender,DataGridPageChangedEventArgs e)

         {

             Dgd_course.CurrentPageIndex=e.NewPageIndex;

             Bindgrid();

         }

         public void DataGrid_edit(object sender,DataGridCommandEventArgs e)

         {

            

             Dgd_course.EditItemIndex=(int)e.Item.ItemIndex;

             Bindgrid();

            

         }

         public void DataGrid_cancel(object sender,DataGridCommandEventArgs e)

         {

            

             Dgd_course.EditItemIndex=-1;

             Bindgrid();

            

         }

         public void DataGrid_delete(object sender,DataGridCommandEventArgs e)

         {

            

             string strsql="delete from course where Course_id=@course_id";

             SqlCommand cm=new SqlCommand(strsql,cn);

             cm.Parameters.Add(new SqlParameter("@course_id",SqlDbType.VarChar,50));

             cm.Parameters["@course_id"].Value=Dgd_course.DataKeys[(int)e.Item.ItemIndex];

             cm.Connection.Open();

             try

             {

                  cm.ExecuteNonQuery();

                  Lbl_note.Text="删除成功";

                 

             }

             catch(SqlException)

             {

                  Lbl_note.Text="删除失败";

                  Lbl_note.Style["color"]="red";

             }

             cm.Connection.Close();         

             Bindgrid();

         }

         public void DataGrid_update(object sender,DataGridCommandEventArgs e)

         {

             string strsql="update course set Course_name=@Course_name,Course_period=@Course_period,Course_credit=@Course_credit,Course_kind=@Course_kind where Course_id=@Course_id";

             SqlCommand cm=new SqlCommand(strsql,cn);

             cm.Parameters.Add(new SqlParameter("@Course_name",SqlDbType.VarChar,50));

             cm.Parameters.Add(new SqlParameter("@Course_period",SqlDbType.Int,4));

             cm.Parameters.Add(new SqlParameter("@Course_credit",SqlDbType.Int,4));

             cm.Parameters.Add(new SqlParameter("@Course_kind",SqlDbType.Int,4));

             cm.Parameters.Add(new SqlParameter("@Course_id",SqlDbType.VarChar,50));

             string colvalue=((TextBox)e.Item.Cells[1].Controls[0]).Text;

             cm.Parameters["@Course_name"].Value=colvalue;

             colvalue=((TextBox)e.Item.Cells[2].Controls[0]).Text;

             cm.Parameters["@Course_period"].Value=colvalue;

             colvalue=((TextBox)e.Item.Cells[3].Controls[0]).Text;

             cm.Parameters["@Course_credit"].Value=colvalue;

             colvalue=((TextBox)e.Item.Cells[4].Controls[0]).Text;

             cm.Parameters["@Course_kind"].Value=colvalue;

             cm.Parameters["@Course_id"].Value=Dgd_course.DataKeys[(int)e.Item.ItemIndex];

             cm.Connection.Open();

             try

             {

                  cm.ExecuteNonQuery();

                  Lbl_note.Text="编辑成功";

                  Dgd_course.EditItemIndex=-1;

             }

             catch(SqlException)

             {

                  Lbl_note.Text="编辑失败";

                  Lbl_note.Style["color"]="red";

             }

             cm.Connection.Close();    

             Bindgrid();

            

         }

         public void Bindgrid()

         {

             strsql="select * from course";

             SqlDataAdapter da=new SqlDataAdapter(strsql,cn);

             DataSet ds=new DataSet();

             da.Fill(ds);

             Dgd_course.DataSource=ds;

             Dgd_course.DataBind();

         }

         private void Lbtn_addcourse_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("addcourse.aspx");

         }

         private void Btn_exit_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("default.aspx");

         }

        

         private void Btn_search_Click(object sender, System.EventArgs e)

         {

             strsql="select * from course  where Course_id='"+Tbx_id.Text+"'or Course_name='"+Tbx_name.Text+"'";

             SqlDataAdapter da=new SqlDataAdapter(strsql,cn);

             DataSet ds=new DataSet();

             da.Fill(ds);

             Dgd_course.DataSource=ds;

             Dgd_course.DataBind();

         }

         private void Lbtn_assign_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("assigncourse.aspx");

         }

    }

}

8.5录入成绩页面

  在录入成绩页面的初始化事件Page_Load()事件对“课程”下拉列表框控件Ddl_course进行初始绑定,使其显示该学生已选的所有课程信息。“录入”按钮的Click事件调用数据库操作语句,对数据库中相应学生,成绩关系表中的成绩信息进行更新。

主要相关代码如下:

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Configuration;

namespace sms

{

    /// <summary>

    /// addgrade 的摘要说明。

    /// </summary>

    public class addgrade : System.Web.UI.Page

    {

         protected System.Web.UI.WebControls.TextBox Tbx_studentid;

         protected System.Web.UI.WebControls.Button Btn_add;

         protected System.Web.UI.WebControls.Label Lbl_note;

         protected System.Web.UI.WebControls.Button Btn_exit;

         protected System.Web.UI.WebControls.TextBox Tbx_term;

         protected System.Web.UI.WebControls.CustomValidator Cv_id;

         protected System.Web.UI.WebControls.DropDownList Ddl_course;

         protected System.Web.UI.WebControls.TextBox Tbx_grade;

        SqlConnection cn;

         private void Page_Load(object sender, System.EventArgs e)

         {

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             // 在此处放置用户代码以初始化页面

             cn=new SqlConnection(strconn); 

         }

         #region Web Form Designer generated code

         override protected void OnInit(EventArgs e)

         {

             //

             // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。

             //

             InitializeComponent();

             base.OnInit(e);

         }

        

         /// <summary>

         /// 设计器支持所需的方法 - 不要使用代码编辑器修改

         /// 此方法的内容。

         /// </summary>

         private void InitializeComponent()

         {   

             this.Tbx_studentid.TextChanged += new System.EventHandler(this.Tbx_studentid_TextChanged);

             this.Cv_id.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Cv_id_ServerValidate);

             this.Btn_add.Click += new System.EventHandler(this.Btn_add_Click);

             this.Btn_exit.Click += new System.EventHandler(this.Btn_exit_Click);

             this.Load += new System.EventHandler(this.Page_Load);

         }

         #endregion

         private void Btn_add_Click(object sender, System.EventArgs e)

         {

             string strsql="update student_course set Student_grade=@Student_grade where Student_id=@Student_id and  Course_id=@Course_id and Course_year=@Course_year";

              SqlCommand cm=new SqlCommand(strsql,cn);

              cm.Parameters.Add(new SqlParameter("@Student_id",SqlDbType.VarChar,50));

              cm.Parameters["@Student_id"].Value=Tbx_studentid.Text;

              cm.Parameters.Add(new SqlParameter("@Course_id",SqlDbType.VarChar,50));

              cm.Parameters["@Course_id"].Value=Ddl_course.SelectedItem.Value;

              cm.Parameters.Add(new SqlParameter("@Course_year",SqlDbType.Char,10));

              cm.Parameters["@Course_year"].Value=Tbx_term.Text;

             cm.Parameters.Add(new SqlParameter("@Student_grade",SqlDbType.Int,4));

             cm.Parameters["@Student_grade"].Value=Tbx_grade.Text;

              cm.Connection.Open();

             try

             {

                  cm.ExecuteNonQuery();

                 Response.Redirect("grade_manage.aspx");

                 

             }

             catch(SqlException)

             {

                  Lbl_note.Text="添加失败";

                  Lbl_note.Style["color"]="red";

             }

              cm.Connection.Close();        

            

         }

        

         private void Btn_exit_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("grade_manage.aspx");

         }

         private void Cv_id_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)

         {

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             cn=new SqlConnection(strconn);

             cn.Open();

             string strsql="select * from student where Student_id='"+Tbx_studentid.Text+"'";

             SqlCommand cm=new SqlCommand(strsql,cn);

             SqlDataReader dr=cm.ExecuteReader();

             if(dr.Read())

             {

                  args.IsValid=true;

             }

             else

             {

                  args.IsValid=false;

             }

             cn.Close();

        

         }

         private void Tbx_studentid_TextChanged(object sender, System.EventArgs e)

         {        //课程名称下拉列表框绑定

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             SqlConnection cn0=new SqlConnection(strconn);

                  cn0.Open ();

                  string mysql1="select course.* from student_course,course where student_course.Student_id='"+Tbx_studentid.Text+"'and student_course.Course_id=course.Course_id";

                  SqlCommand cm1=new SqlCommand  (mysql1,cn0);

                  SqlDataReader dr1=cm1.ExecuteReader ();

                  while(dr1.Read ())

                  {

                      Ddl_course.Items .Add (new ListItem(dr1["Course_name"].ToString() ,dr1["Course_id"].ToString()) );

                  }

                  cn0.Close ();

            

         }

        

    }

}

8.6添加学生必修课页面

     在添加学生必修课页面初始化事件Page_Load事件中将数据库中的所有课程及班级信息分别绑定到DropDownList控件的Ddl_course和Ddl_class控件中,“确定”按钮Btn_ok控件的Click()事件完成往数据库学生-课程信息表中添加所选班级范围下所有学生的相应课程选课记录的任务。

主要相关代码如下:

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Configuration;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

namespace sms

{

    /// <summary>

    /// addstudentcourse 的摘要说明。

    /// </summary>

    public class addstudentcourse : System.Web.UI.Page

    {

         protected System.Web.UI.WebControls.DropDownList Ddl_course;

         protected System.Web.UI.WebControls.DropDownList Ddl_class;

         protected System.Web.UI.WebControls.TextBox Tbx_year;

         protected System.Web.UI.WebControls.Button Btn_ok;

         protected System.Web.UI.WebControls.Label Lbl_note;

         protected System.Web.UI.WebControls.Button Btn_back;

       

         private void Page_Load(object sender, System.EventArgs e)

         {

             // 在此处放置用户代码以初始化页面

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             //连接本地计算机的sms数据库

             SqlConnection cn0= new SqlConnection (strconn);

             if(!IsPostBack)

             {

                  //课程名称下拉列表框绑定

                  cn0.Open ();

                  string mysql1="select * from course where Course_kind='0'or Course_kind='1'";

                  SqlCommand cm1=new SqlCommand  (mysql1,cn0);

                  SqlDataReader dr1=cm1.ExecuteReader ();

                  while(dr1.Read ())

                  {

                      Ddl_course.Items .Add (new ListItem(dr1["Course_name"].ToString() ,dr1["Course_id"].ToString()) );

                  }

                  cn0.Close ();

                  //班级名称下拉列表框绑定

                  cn0.Open ();

                  string mysql2="select * from class";

                  SqlCommand cm2=new SqlCommand  (mysql2,cn0);

                  SqlDataReader dr2=cm2.ExecuteReader ();               

                  while(dr2.Read ())

                  {

                      Ddl_class.Items .Add (new ListItem(dr2["Class_name"].ToString() ,dr2["Class_id"].ToString()) );

                  }

                  cn0.Close ();

             }

         }

         override protected void OnInit(EventArgs e)

         {

             //

             // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。

             //

             InitializeComponent();

             base.OnInit(e);

         }

        

         /// <summary>

         /// 设计器支持所需的方法 - 不要使用代码编辑器修改

         /// 此方法的内容。

         /// </summary>

         private void InitializeComponent()

         {   

             this.Btn_ok.Click += new System.EventHandler(this.Btn_ok_Click);

             this.Btn_back.Click += new System.EventHandler(this.Btn_back_Click);

             this.Load += new System.EventHandler(this.Page_Load);

         }

         #endregion

         private void Btn_ok_Click(object sender, System.EventArgs e)

         {

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             SqlConnection cn= new SqlConnection (strconn);

             cn.Open();

             string strsql="insert into student_course(Student_id,Course_id,Course_year) (select Student_id,@Course_id,@Course_year from student where Student_classid=@classid) ";

             SqlCommand cm=new SqlCommand(strsql,cn);

             cm.Parameters.Add(new SqlParameter("@classid",SqlDbType.VarChar,50));

             cm.Parameters["@classid"].Value=Ddl_class.SelectedItem.Value;

             cm.Parameters.Add(new SqlParameter("@Course_id",SqlDbType.VarChar,50));

             cm.Parameters["@Course_id"].Value=Ddl_course.SelectedItem.Value;

             cm.Parameters.Add(new SqlParameter("@Class_id",SqlDbType.VarChar,50));

             cm.Parameters["@Class_id"].Value=Ddl_class.SelectedItem.Value;

             cm.Parameters.Add(new SqlParameter("@Course_year",SqlDbType.VarChar,50));

             cm.Parameters["@Course_year"].Value=Tbx_year.Text;         

             try

             {

                  cm.ExecuteNonQuery();

                  Lbl_note.Text="添加成功,请返回";

                 

             }

             catch(SqlException)

             {

                  Lbl_note.Text="添加失败";

                  Lbl_note.Style["color"]="red";

             }  

             cn.Close();

         }

         private void Btn_back_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("course.aspx");

         }

    }

}

8.7成绩管理页面

成绩管理页面完成的功能比较多,包括按选定的条件进行限定条件的成绩查询。同时,也可以根据成绩范围对包含在该范围中的学生成绩作一统计,具体统计这门课的平均分,最高分,参加考试总人数以及优秀人数和不及格人数。此页面的关键就在于根据条件生成SQL语句。当“查询”“统计”操作被触发,系统将完成对数据库中多个表 的操作。

主要相关代码如下:

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Configuration;

namespace sms

{

    /// <summary>

    /// grade_manage 的摘要说明。

    /// </summary>

    public class grade_manage : System.Web.UI.Page

    {

         protected System.Web.UI.WebControls.DropDownList Ddl_way;

         protected System.Web.UI.WebControls.TextBox Tbx_name;

         protected System.Web.UI.WebControls.Button Btn_search;

         protected System.Web.UI.WebControls.DataGrid Dgd_grade;

         protected System.Web.UI.WebControls.LinkButton Link_addgrade;

        SqlConnection cn;

         protected System.Web.UI.WebControls.Label Lbl_note;

         protected System.Web.UI.WebControls.DropDownList Ddl_stat;

         protected System.Web.UI.WebControls.TextBox Tbx_area;

         protected System.Web.UI.WebControls.TextBox Tbx_classid;

         protected System.Web.UI.WebControls.DropDownList Ddl_content;

         protected System.Web.UI.WebControls.Button Btn_count;

         protected System.Web.UI.WebControls.TextBox Tbx_year;

         protected System.Web.UI.WebControls.Label Lbl_average;

         protected System.Web.UI.WebControls.Label Lbl_high;

         protected System.Web.UI.WebControls.Label Lbl_a;

         protected System.Web.UI.WebControls.Label Lbl_unpass;

         protected System.Web.UI.WebControls.Label Lbl_all;

         protected System.Web.UI.WebControls.TextBox Tbx_term;

         string strsql;

         private void Page_Load(object sender, System.EventArgs e)

         {

             // 在此处放置用户代码以初始化页面

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             cn=new SqlConnection(strconn); 

         }

         #region Web Form Designer generated code

         override protected void OnInit(EventArgs e)

         {

             //

             // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。

             //

             InitializeComponent();

             base.OnInit(e);

         }

        

         /// <summary>

         /// 设计器支持所需的方法 - 不要使用代码编辑器修改

         /// 此方法的内容。

         /// </summary>

         private void InitializeComponent()

         {   

             this.Btn_count.Click += new System.EventHandler(this.Btn_count_Click);

             this.Btn_search.Click += new System.EventHandler(this.Btn_search_Click);

             this.Link_addgrade.Click += new System.EventHandler(this.Link_addgrade_Click);

             this.Load += new System.EventHandler(this.Page_Load);

         }

         #endregion

        

         private void Link_addgrade_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("addgrade.aspx");

         }

         private void Btn_search_Click(object sender, System.EventArgs e)

         {

             Bindgrid();

         }

         public void DataGrid_Page(object sender,DataGridPageChangedEventArgs e)

         {

             Dgd_grade.CurrentPageIndex=e.NewPageIndex;

             Bindgrid();

         }

         public void Bindgrid()

         {

             if(Ddl_way.SelectedItem.Text=="按学号")

             {

                  if(Tbx_term.Text=="所有")

                  {

                      strsql="select student_course.ID,student_course.Student_id,student.Student_name,student.Student_classid,student_course.Course_id,course.Course_name,teacher.Teacher_name,student_course.Student_grade from course,student,teacher,student_course,teacher_course where student_course.Student_id='"+Tbx_name.Text+"' and student_course.Course_id=course.Course_id and student_course.Student_id=student.Student_id and student_course.Course_id=teacher_course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and teacher_course.Class_id=student.Student_classid";

                  }

                  else

                  {

                      strsql="select student_course.ID,student_course.Student_id,student.Student_name,student.Student_classid,student_course.Course_id,course.Course_name,teacher.Teacher_name,student_course.Student_grade from course,student,teacher,student_course,teacher_course where student_course.Student_id='"+Tbx_name.Text+"' and Course_year='"+Tbx_term.Text+"' and student_course.Course_id=course.Course_id and student_course.Student_id=student.Student_id and student_course.Course_id=teacher_course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and teacher_course.Class_id=student.Student_classid";

                  }

             }

             else if(Ddl_way.SelectedItem.Text=="按课号")

             {

                  if(Tbx_term.Text=="所有")

                  {

                      strsql="select student_course.ID,student_course.Student_id,student.Student_name,student.Student_classid,student_course.Course_id,course.Course_name,teacher.Teacher_name,student_course.Student_grade from course,student,teacher,student_course,teacher_course where student_course.Course_id='"+Tbx_name.Text+"' and student_course.Course_id=course.Course_id and student_course.Student_id=student.Student_id and student_course.Course_id=teacher_course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and teacher_course.Class_id=student.Student_classid";

                  }

                  else

                  {

                      strsql="select student_course.ID,student_course.Student_id,student.Student_name,student.Student_classid,student_course.Course_id,course.Course_name,teacher.Teacher_name,student_course.Student_grade from course,student,teacher,student_course,teacher_course where student_course.Course_id='"+Tbx_name.Text+"' and student_course.Course_year='"+Tbx_term.Text+"' and student_course.Course_id=course.Course_id and student_course.Student_id=student.Student_id and student_course.Course_id=teacher_course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and teacher_course.Class_id=student.Student_classid";

                  }

             }

             else if(Ddl_way.SelectedItem.Text=="按课程名")

             {

                  if(Tbx_term.Text=="所有")

                  {

                      strsql="select student_course.ID,student_course.Student_id,student.Student_name,student.Student_classid,student_course.Course_id,course.Course_name,teacher.Teacher_name,student_course.Student_grade from course,student,teacher,student_course,teacher_course where course.Course_name='"+Tbx_name.Text+"' and student_course.Course_id=course.Course_id and student_course.Student_id=student.Student_id and student_course.Course_id=teacher_course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and teacher_course.Class_id=student.Student_classid";

            

                  }

                  else

                  {

                      strsql="select student_course.ID,student_course.Student_id,student.Student_name,student.Student_classid,student_course.Course_id,course.Course_name,teacher.Teacher_name,student_course.Student_grade from course,student,teacher,student_course,teacher_course where course.Course_name='"+Tbx_name.Text+"' and student_course.Course_year='"+Tbx_term.Text+"' and student_course.Course_id=course.Course_id and student_course.Student_id=student.Student_id and student_course.Course_id=teacher_course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and teacher_course.Class_id=student.Student_classid";

                  }

             }

             else if(Ddl_way.SelectedItem.Text=="按班级")

             {

                  if(Tbx_term.Text=="所有")

                  {

                      strsql="select student_course.ID,student_course.Student_id,student.Student_name,student.Student_classid,student_course.Course_id,course.Course_name,teacher.Teacher_name,student_course.Student_grade from course,student,teacher,student_course,teacher_course where student.Student_classid='"+Tbx_name.Text+"'and student_course.Course_id=course.Course_id and student_course.Student_id=student.Student_id and student_course.Course_id=teacher_course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and teacher_course.Class_id=student.Student_classid";

            

                  }

                  else

                  {

                      strsql="select student_course.ID,student_course.Student_id,student.Student_name,student.Student_classid,student_course.Course_id,course.Course_name,teacher.Teacher_name,student_course.Student_grade from course,student,teacher,student_course,teacher_course where student.Student_classid='"+Tbx_name.Text+"' and student_course.Course_year='"+Tbx_term.Text+"' and student_course.Course_id=course.Course_id and student_course.Student_id=student.Student_id and student_course.Course_id=teacher_course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and teacher_course.Class_id=student.Student_classid";

                  }

             }

             else if(Ddl_way.SelectedItem.Text=="按教师号")

             {

                  if(Tbx_term.Text=="所有")

                  {

                      strsql="select student_course.ID,student_course.Student_id,student.Student_name,student.Student_classid,student_course.Course_id,course.Course_name,teacher.Teacher_name,student_course.Student_grade from course,student,teacher,student_course,teacher_course where teacher.Teacher_id='"+Tbx_name.Text+"' and student_course.Course_id=course.Course_id and student_course.Student_id=student.Student_id and student_course.Course_id=teacher_course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and teacher_course.Class_id=student.Student_classid";

            

                  }

                  else

                  {

                      strsql="select student_course.ID,student_course.Student_id,student.Student_name,student.Student_classid,student_course.Course_id,course.Course_name,teacher.Teacher_name,student_course.Student_grade from course,student,teacher,student_course,teacher_course where teacher.Teacher_id='"+Tbx_name.Text+"' and student_course.Course_year='"+Tbx_term.Text+"' and student_course.Course_id=course.Course_id and student_course.Student_id=student.Student_id and student_course.Course_id=teacher_course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and teacher_course.Class_id=student.Student_classid";

                  }

             }

            

             SqlCommand cm=new SqlCommand(strsql,cn);

             cn.Open();

             SqlDataReader dr=cm.ExecuteReader();

             if(dr.Read())

             {

                  Dgd_grade.Visible=true;

                  cn.Close();

                  cn.Open();

                  SqlDataAdapter da=new SqlDataAdapter(strsql,cn);

                  DataSet ds=new DataSet();

                  da.Fill(ds);

                  Dgd_grade.DataSource=ds;

                  Dgd_grade.DataBind();

             }

             else

             {

                  Dgd_grade.Visible=false;

                  Lbl_note.Text="无纪录!";

             }

             cn.Close();

         }

         public void DataGrid_cancel(object sender,DataGridCommandEventArgs e)

         {

            

             Dgd_grade.EditItemIndex=-1;

             Bindgrid();

            

         }

         public void DataGrid_edit(object sender,DataGridCommandEventArgs e)

         {

            

             Dgd_grade.EditItemIndex=(int)e.Item.ItemIndex;

             Bindgrid();

            

         }

         public void DataGrid_update(object sender,DataGridCommandEventArgs e)

         {

             string strsql="update student_course set Student_grade=@Student_grade where Student_id=@Student_id and Course_id=@Course_id and ID=@id";

             SqlCommand cm=new SqlCommand(strsql,cn);

             cm.Parameters.Add(new SqlParameter("@Student_grade",SqlDbType.Int,4));

             cm.Parameters.Add(new SqlParameter("@Course_id",SqlDbType.VarChar,50));

             cm.Parameters.Add(new SqlParameter("@Student_id",SqlDbType.VarChar,50));

             cm.Parameters.Add(new SqlParameter("@id",SqlDbType.Char,10));

             string colvalue=((TextBox)e.Item.Cells[7].Controls[0]).Text;

             cm.Parameters["@Student_grade"].Value=colvalue;

             cm.Parameters["@Student_id"].Value=e.Item.Cells[1].Text;

             cm.Parameters["@Course_id"].Value=e.Item.Cells[4].Text;

             cm.Parameters["@Student_grade"].Value=colvalue;

             cm.Parameters["@id"].Value=Dgd_grade.DataKeys[(int)e.Item.ItemIndex];

             cm.Connection.Open();

             try

             {

                  cm.ExecuteNonQuery();

                  Lbl_note.Text="编辑成功";

                  Dgd_grade.EditItemIndex=-1;

             }

             catch(SqlException)

             {

                  Lbl_note.Text="编辑失败";

                  Lbl_note.Style["color"]="red";

             }

             cm.Connection.Close();    

             Bindgrid();

            

         }

        

         public void DataGrid_delete(object sender,DataGridCommandEventArgs e)

         {

            

             string strsql="delete from student_course where ID=@id";

             SqlCommand cm=new SqlCommand(strsql,cn);

             cm.Parameters.Add(new SqlParameter("@id",SqlDbType.Char,10));           

            cm.Parameters["@id"].Value=Dgd_grade.DataKeys[(int)e.Item.ItemIndex];

             cm.Connection.Open();

             try

             {

                  cm.ExecuteNonQuery();

                  Lbl_note.Text="删除成功";

                 

             }

             catch(SqlException)

             {

                  Lbl_note.Text="删除失败";

                  Lbl_note.Style["color"]="red";

             }

             cm.Connection.Close();         

             Bindgrid();

         }

         private void Btn_count_Click(object sender, System.EventArgs e)

         {

             if(Ddl_stat.SelectedItem.Value=="系别")

             {

                     

                if(Ddl_content.SelectedItem.Text=="总人数")

                {

                     strsql="select AVG(Student_grade),MAX(Student_grade),COUNT(*) from student_course,student,class where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"'and student_course.Student_id=student.Student_id and student.Student_classid=class.Class_id and class.Class_department='"+Tbx_area.Text+"' ";

                }

                else if(Ddl_content.SelectedItem.Text=="优秀人数")

                {

                     strsql="select AVG(Student_grade),MAX(Student_grade),COUNT(*) from student_course,student,class where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"'and student_course.Student_id=student.Student_id and student.Student_classid=class.Class_id and class.Class_department='"+Tbx_area.Text+"'and Student_grade>=85 ";

                }

                else if(Ddl_content.SelectedItem.Text=="不及格人数")

                {

                     strsql="select AVG(Student_grade),MAX(Student_grade),COUNT(*) from student_course,student,class where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"'and student_course.Student_id=student.Student_id and student.Student_classid=class.Class_id and class.Class_department='"+Tbx_area.Text+"'and Student_grade<60 ";

                }

                  else

                {

                   strsql="select AVG(Student_grade),MAX(Student_grade) from student_course,student,class where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"'and student_course.Student_id=student.Student_id and student.Student_classid=class.Class_id and class.Class_department='"+Tbx_area.Text+"' ";

                }

             }

             else if(Ddl_stat.SelectedItem.Value=="学院")

             {

                  if(Ddl_content.SelectedItem.Text=="总人数")

                  {

                      strsql="select AVG(Student_grade),MAX(Student_grade),COUNT(*) from student_course,student,class where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"'and student_course.Student_id=student.Student_id and student.Student_classid=class.Class_id and class.Class_college='"+Tbx_area.Text+"' ";

                  }

                  else if(Ddl_content.SelectedItem.Text=="优秀人数")

                  {

                      strsql="select AVG(Student_grade),MAX(Student_grade),COUNT(*) from student_course,student,class where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"'and student_course.Student_id=student.Student_id and student.Student_classid=class.Class_id and class.Class_college='"+Tbx_area.Text+"'and Student_grade>=85 ";

                  }

                  else if(Ddl_content.SelectedItem.Text=="不及格人数")

                  {

                      strsql="select AVG(Student_grade),MAX(Student_grade),COUNT(*) from student_course,student,class where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"'and student_course.Student_id=student.Student_id and student.Student_classid=class.Class_id and class.Class_college='"+Tbx_area.Text+"'and Student_grade<60 ";

                  }

                  else

                  {

                          strsql="select AVG(Student_grade),MAX(Student_grade) from student_course,student,class where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"'and student_course.Student_id=student.Student_id and student.Student_classid=class.Class_id and class.Class_college='"+Tbx_area.Text+"' ";

                  }

                 

                 

             }

             else if(Ddl_stat.SelectedItem.Value=="班级")

             {

                  if(Ddl_content.SelectedItem.Text=="总人数")

                  {

                      strsql="select AVG(Student_grade),MAX(Student_grade),COUNT(*) from student_course,student where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"' and student_course.Student_id=student.Student_id and student.Student_classid='"+Tbx_area.Text+"'";

                  }

                  else if(Ddl_content.SelectedItem.Text=="优秀人数")

                  {

                  strsql="select AVG(Student_grade),MAX(Student_grade),COUNT(*) from student_course,student where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"' and student_course.Student_id=student.Student_id and student.Student_classid='"+Tbx_area.Text+"'and Student_grade>=85";

                  }

                  else if(Ddl_content.SelectedItem.Text=="不及格人数")

                   {strsql="select AVG(Student_grade),MAX(Student_grade),COUNT(*) from student_course,student where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"' and student_course.Student_id=student.Student_id and student.Student_classid='"+Tbx_area.Text+"'and Student_grade<60";

                  }

                  else

                  {

                    strsql="select AVG(Student_grade),MAX(Student_grade) from student_course,student where Course_id='"+Tbx_classid.Text+"' and student_course.Course_year='"+Tbx_year.Text+"' and student_course.Student_id=student.Student_id and student.Student_classid='"+Tbx_area.Text+"'";

                  }

                     

                 

             }

             SqlCommand cm=new SqlCommand(strsql,cn);

             cn.Open();

             SqlDataReader dr=cm.ExecuteReader();

             if(dr.Read())

             {

                  if(Ddl_content.SelectedItem.Text=="均分")

                  {

                      Lbl_average.Visible=true;

                      Lbl_average.Text="平均分为:"+dr[0].ToString();

                  }

                  else if(Ddl_content.SelectedItem.Text=="最高分")

                  {

                      Lbl_high.Visible=true;

                      Lbl_high.Text="最高分为:"+dr[1].ToString();

                  }

                  else if(Ddl_content.SelectedItem.Text=="总人数")

                  {

                      Lbl_all.Visible=true;

                      Lbl_all.Text="总人数为:"+dr[2].ToString();

                  }

                  else if(Ddl_content.SelectedItem.Text=="优秀人数")

                  {

                      Lbl_a.Visible=true;

                      Lbl_a.Text="优秀人数为:"+dr[2].ToString();

                  }

                  else if(Ddl_content.SelectedItem.Text=="不及格人数")

                  {

                          Lbl_unpass.Visible=true;

                      Lbl_unpass.Text="不及格人数为:"+dr[2].ToString();

                  }

                  else

                  {Lbl_note.Text="无此信息";

                  }

                  cn.Close();

             }

              

         }

        

    }

}

8.8学生选课管理页面

学生选课管理页面窗体所示,学生选课后需要管理员进一步确认管理,来确定最终选课信息。

主要相关代码如下:

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Configuration;

namespace sms

{

    /// <summary>

    /// student_course 的摘要说明。

    /// </summary>

    public class student_course : System.Web.UI.Page

    {

         protected System.Web.UI.WebControls.Button Btn_student;

         protected System.Web.UI.WebControls.DataGrid Dgd_sort;

         protected System.Web.UI.WebControls.Label Lbl_all;

         protected System.Web.UI.WebControls.TextBox Tbx_year;

         protected System.Web.UI.WebControls.Label Lbl_note;

         protected System.Web.UI.WebControls.Button Btn_exit;

         protected System.Web.UI.WebControls.DropDownList Ddl_course;

         protected System.Web.UI.WebControls.DropDownList Ddl_teacher;

        SqlConnection cn;

         private void Page_Load(object sender, System.EventArgs e)

         {   //教师名称下拉列表框绑定

             string strconn= ConfigurationSettings.AppSettings["dsn"];

             //连接本地计算机的sms数据库

             SqlConnection cn0= new SqlConnection (strconn);

             if(!IsPostBack)

             {

                  cn0.Open ();

                  string mysql="select * from teacher";

                  SqlCommand cm0=new SqlCommand  (mysql,cn0);

                  SqlDataReader dr0=cm0.ExecuteReader ();

                  while(dr0.Read ())

                  {

                      Ddl_teacher.Items .Add (new ListItem(dr0["Teacher_name"].ToString(),dr0["Teacher_id"].ToString()) );

                  }

                  cn0.Close ();

                  //课程名称下拉列表框绑定

                  cn0.Open ();

                  string mysql1="select * from course";

                  SqlCommand cm1=new SqlCommand  (mysql1,cn0);

                  SqlDataReader dr1=cm1.ExecuteReader ();

                  while(dr1.Read ())

                  {

                      Ddl_course.Items .Add (new ListItem(dr1["Course_name"].ToString() ,dr1["Course_id"].ToString()) );

                  }

                  cn0.Close ();

             }

             // 在此处放置用户代码以初始化页面

             cn=new SqlConnection(strconn);

            

         }

         #region Web Form Designer generated code

         override protected void OnInit(EventArgs e)

         {

             //

             // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。

             //

             InitializeComponent();

             base.OnInit(e);

         }

        

         /// <summary>

         /// 设计器支持所需的方法 - 不要使用代码编辑器修改

         /// 此方法的内容。

         /// </summary>

         private void InitializeComponent()

         {   

             this.Btn_student.Click += new System.EventHandler(this.Btn_student_Click);

             this.Btn_exit.Click += new System.EventHandler(this.Btn_exit_Click);

             this.Load += new System.EventHandler(this.Page_Load);

         }

         #endregion

         private void Btn_student_Click(object sender, System.EventArgs e)

         { Bindgrid();      

         }

         public void DataGrid_delete(object sender,DataGridCommandEventArgs e)

         {

            

             string strsql="delete from student_course where ID=@id";

             SqlCommand cm=new SqlCommand(strsql,cn);

             cm.Parameters.Add(new SqlParameter("@ID",SqlDbType.BigInt,8));

             cm.Parameters["@id"].Value=Dgd_sort.DataKeys[(int)e.Item.ItemIndex];

             cm.Connection.Open();

             try

             {

                  cm.ExecuteNonQuery();

                  Lbl_note.Text="删除成功";

                 

             }

             catch(SqlException)

             {

                  Lbl_note.Text="删除失败";

                  Lbl_note.Style["color"]="red";

             }

             cm.Connection.Close();         

             Bindgrid();

         }

        

         public void Bindgrid()

         {

            string strsql="select student_course.ID,student.Student_id,student.Student_classid from student_course,student,teacher_course where student_course.Course_id='"+Ddl_course.SelectedItem.Value+"' and student_course.Course_year=teacher_course.Course_year and student_course.Course_year='"+Tbx_year.Text+"'and teacher_course.Teacher_id='"+Ddl_teacher.SelectedItem.Value+"'and student_course.Course_id=teacher_course.Course_id and student.Student_id=student_course.Student_id";

             SqlDataAdapter da=new SqlDataAdapter(strsql,cn);

             DataSet ds=new DataSet();

             da.Fill(ds);

             Dgd_sort.DataSource=ds;

             Dgd_sort.DataBind();

             string strsq="select COUNT(*) from student_course,student,teacher_course where student_course.Course_id='"+Ddl_course.SelectedItem.Value+"' and  student_course.Course_year=teacher_course.Course_year and student_course.Course_year='"+Tbx_year.Text+"'and teacher_course.Teacher_id='"+Ddl_teacher.SelectedItem.Value+"'and student_course.Course_id=teacher_course.Course_id and student.Student_id=student_course.Student_id";

             SqlCommand cm1=new SqlCommand(strsq,cn);     

             cn.Open();

             SqlDataReader dr=cm1.ExecuteReader();

             if(dr.Read())

             {

                      Lbl_all.Text="选课总人数为:"+dr[0].ToString();

             }

             else

             {

                  Lbl_all.Text="无人选此课";

             }

             cn.Close();

         }

         private void Btn_exit_Click(object sender, System.EventArgs e)

         {

             Response.Redirect("default.aspx");

         }

        

    }

}

8.9学生选课页面

学生可进入学生选课页面浏览本学期待选课程的信息,可以设定查询条件,可以根据选此课的人数,教师等情况来确定是否选择此课。

主要相关代码如下:

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Configuration;

namespace sms

{

    /// <summary>

    /// sortcourse 的摘要说明。

    /// </summary>

    public class sortcourse : System.Web.UI.Page

    {

         protected System.Web.UI.WebControls.DataGrid Dgd_sort;

         protected System.Web.UI.WebControls.TextBox Tbx_courseid;

         protected System.Web.UI.WebControls.TextBox Tbx_year;

         protected System.Web.UI.WebControls.Button Btn_look;

         protected System.Web.UI.WebControls.TextBox Tbx_teacher;

         protected System.Web.UI.WebControls.TextBox Tbx_term;

         protected System.Web.UI.WebControls.Button Btn_sort;

         protected System.Web.UI.WebControls.Label Lbl_all;

         protected System.Web.UI.WebControls.Label Lbl_note;

         protected System.Web.UI.WebControls.Button Btn_yes;

         protected System.Web.UI.WebControls.Button Btn_no;

         protected System.Web.UI.WebControls.Panel Pn_yes;

         protected System.Web.UI.WebControls.CustomValidator Cv_course;

         protected System.Web.UI.WebControls.RequiredFieldValidator Rfv_year;

         SqlConnection cn;

         protected System.Web.UI.WebControls.DropDownList Ddl_course;string strsql;

         private void Page_Load(object sender, System.EventArgs e)

         {   string strconn= ConfigurationSettings.AppSettings["dsn"];

             cn=new SqlConnection(strconn); 

             if(!IsPostBack)

             {

                  //课程名称下拉列表框绑定

                 

                  SqlConnection cn0=new SqlConnection(strconn);

                  cn0.Open ();

                  string mysql1="select * from course where Course_kind='2'";

                  SqlCommand cm1=new SqlCommand (mysql1,cn0);

                  SqlDataReader dr1=cm1.ExecuteReader ();

                  Ddl_course.Items .Add (new ListItem("","") );

                  while(dr1.Read ())

                  {

                      Ddl_course.Items .Add (new ListItem(dr1["Course_name"].ToString() ,dr1["Course_id"].ToString()) );

                  }

                  cn0.Close ();

                 

             }

         }

         #region Web Form Designer generated code

         override protected void OnInit(EventArgs e)

         {

             //

             // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。

             //

             InitializeComponent();

             base.OnInit(e);

         }        /// <summary>

         /// 设计器支持所需的方法 - 不要使用代码编辑器修改

         /// 此方法的内容。

         /// </summary>

         private void InitializeComponent()

         {   

             this.Btn_sort.Click += new System.EventHandler(this.Btn_sort_Click);

             this.Cv_course.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Cv_course_ServerValidate);

             this.Btn_yes.Click += new System.EventHandler(this.Btn_yes_Click);

             this.Btn_no.Click += new System.EventHandler(this.Btn_no_Click);

             this.Btn_look.Click += new System.EventHandler(this.Btn_look_Click);

             this.Load += new System.EventHandler(this.Page_Load);

         }

         #endregion

         private void Btn_sort_Click(object sender, System.EventArgs e)

         {

            

             string strsq="select COUNT(Student_id) from student_course where Course_id='"+Tbx_courseid.Text+"' and Course_year='"+Tbx_year.Text+"'";

             SqlCommand cm1=new SqlCommand(strsq,cn);     

             cn.Open();

             SqlDataReader dr=cm1.ExecuteReader();

             if(dr.Read())

             {

                  Lbl_all.Text="选此课总人数为:"+dr[0].ToString();

            }

             else

             {

                  Lbl_all.Text="无人选此课";

             }

             Pn_yes.Visible=true;

             cn.Close();

        

         }

     

         private void Btn_yes_Click(object sender, System.EventArgs e)

         {

             strsql="insert into student_course(Student_id,Course_id,Course_year) values(@Student_id,@Course_id,@Course_year)";

             SqlCommand cm=new SqlCommand(strsql,cn);

             cm.Parameters.Add(new SqlParameter("@Student_id",SqlDbType.VarChar,50));

             cm.Parameters.Add(new SqlParameter("@Course_id",SqlDbType.VarChar,50));

             cm.Parameters.Add(new SqlParameter("@Course_year",SqlDbType.VarChar,50));

             cm.Parameters["@Student_id"].Value=Session["User_id"].ToString();

             cm.Parameters["@Course_id"].Value=Tbx_courseid.Text;

             cm.Parameters["@Course_year"].Value=Tbx_year.Text;

             cn.Open();

             try

             {

                  cm.ExecuteNonQuery();

             }

             catch(SqlException)

             {

                  Lbl_note.Text="添加失败!";

             }

           

             cn.Close();

        

         }

         private void Btn_no_Click(object sender, System.EventArgs e)

         {

          Lbl_all.Text="请重新选择";

         }

         private void Cv_course_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)

         {           

             cn.Open();

             strsql="select * from course where Course_id='"+Tbx_courseid.Text+"'";

             SqlCommand cm=new SqlCommand(strsql,cn);

             SqlDataReader dr=cm.ExecuteReader();

             if(dr.Read())

             {

                  args.IsValid=true;

             }

             else

             {

                  args.IsValid=false;

             }

             cn.Close();

         }

         private void Btn_look_Click(object sender, System.EventArgs e)

         {

             if(Ddl_course.SelectedItem.Text=="")

             {

                  if(Tbx_teacher.Text=="")

                  {strsql="select course.Course_name,course.Course_id,teacher.Teacher_name,course.Course_credit,course.Course_period from course,teacher,teacher_course where teacher_course.Course_year='"+Tbx_term.Text+"' and teacher_course.Course_id=course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id";

                  }

                  else

                  {

                  strsql="select course.Course_name,course.Course_id,teacher.Teacher_name,course.Course_credit,course.Course_period from course,teacher,teacher_course where teacher_course.Course_year='"+Tbx_term.Text+"' and teacher_course.Course_id=course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and teacher.Teacher_name='"+Tbx_teacher.Text+"'";

            

                  }

             }

             else

             {

                  if(Tbx_teacher.Text=="")

                  {

                  strsql="select course.Course_name,course.Course_id,teacher.Teacher_name,course.Course_credit,course.Course_period from course,teacher,teacher_course where teacher_course.Course_year='"+Tbx_term.Text+"' and teacher_course.Course_id=course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and course.Course_name='"+Ddl_course.SelectedItem.Text+"'";

            

                  }

                  else

                  {

                      strsql="select course.Course_name,course.Course_id,teacher.Teacher_name,course.Course_credit,course.Course_period from course,teacher,teacher_course where teacher_course.Course_year='"+Tbx_term.Text+"' and teacher_course.Course_id=course.Course_id and teacher_course.Teacher_id=teacher.Teacher_id and course.Course_name='"+Ddl_course.SelectedItem.Text+"' and teacher.Teacher_name='"+Tbx_teacher.Text+"'";

            

                  }

             }

             SqlDataAdapter da=new SqlDataAdapter(strsql,cn);

             DataSet ds=new DataSet();

             da.Fill(ds);

             Dgd_sort.DataSource=ds;

             Dgd_sort.DataBind();

         }

        

    }

}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/615161.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

终端安全管理防护软件排行榜2024(四大终端监控软件推荐)

你的企业存在这些问题吗&#xff1f; 数字化转型的深入和远程办公模式的普及&#xff0c;企业对终端安全管理的需求日益凸显。 确保终端设备的安全性不仅关乎数据保护、业务连续性&#xff0c;更直接影响企业的声誉与合规性。 2024年终端安全防护软件排行榜&#xff0c;有谁荣…

搞嵌入式需要什么条件?

嵌入式系统是一种将计算机系统嵌入到物理设备中的技术&#xff0c;是现代电子技术的重要组成部分&#xff0c;具有广泛的应用领域。 那么&#xff0c;搞嵌入式需要什么条件呢&#xff1f; 嵌入式可以简单分为硬件与软件两个方向。做嵌入式软件需要对语言有一定的基础&#xf…

使用in运算符检查状态活动

在具有并行状态分解的Stateflow图表中&#xff0c;子状态可以同时处于活动状态。如果检查状态活动&#xff0c;则可以在两个平行状态下同步子状态。 例如&#xff0c;此图表有两个平行的状态&#xff1a;Place和Tracker。Tracker中的转换会在适当的位置检查状态活动&#xff0c…

服务器远程桌面局域网连接不上的解决方法

在企业网络环境中&#xff0c;服务器远程桌面局域网连接不上是一个常见且棘手的问题。这种问题可能导致工作效率下降&#xff0c;甚至影响业务运营。因此&#xff0c;我们需要采取专业的方法来解决这一问题。 服务器远程桌面局域网连接不上的解决方法&#xff1a; 1、确保服务器…

弱监督语义分割-对CAM的生成过程进行改进1

一、仿射变换图像结合正则项优化CAM生成 论文&#xff1a;Self-supervised Equivariant Attention Mechanism for Weakly Supervised Semantic Segmentation &#xff08;CVPR,2020&#xff09; 1.SEAM方法 孪生网络架构&#xff08;Siamese Network Architecture&#xff09…

【CTF Web】XCTF GFSJ0478 cookie Writeup(HTTP协议+信息收集+Cookie)

cookie X老师告诉小宁他在cookie里放了些东西&#xff0c;小宁疑惑地想&#xff1a;‘这是夹心饼干的意思吗&#xff1f;’ 解法 按 F12&#xff0c;点击网络。 刷新页面。查看请求头中的 Cookie。 look-herecookie.php访问&#xff1a; http://61.147.171.105:53668/cookie.…

智慧互联,统信UOS V20桌面专业版(1070)解锁办公新模式丨年度更新

从小屏到大屏 突破&#xff0c;就在方寸之间 从人机到智脑 融合&#xff0c;旨在新质生产力 统信UOS一直致力于将先进科技与用户场景相结合&#xff0c;不断提升用户的工作效率和生产力。在最新发布的统信UOS V20桌面专业版&#xff08;1070&#xff09;版本中&#xff0c;我们…

MySQL指令

MySQL指令 1.数据库管理 查看已有的数据库(文件夹) show databases;创建数据库(文件夹) create database 数据库名字; #可能有汉字&#xff0c;编码方式可能不适用&#xff0c;产生乱码create database 数据库名字 DEFAULT CHARSET utf8 COLLATE utf8_general_ci ; #使用utf8…

Scala编程入门:从零开始的完整教程

目录 引言环境准备创建第一个Scala项目基本语法高阶概念进阶资源结语 引言 Scala是一种强大的、静态类型的、多范式编程语言&#xff0c;它结合了面向对象和函数式编程的特点。本教程将指导您如何从零开始学习Scala&#xff0c;并搭建一个简单的开发环境。让我们开始探索Scala…

2024数维杯数学建模B题完整论文讲解(含每一问python代码+结果+可视化图)

大家好呀&#xff0c;从发布赛题一直到现在&#xff0c;总算完成了2024数维杯数学建模挑战赛生物质和煤共热解问题的研究完整的成品论文。 本论文可以保证原创&#xff0c;保证高质量。绝不是随便引用一大堆模型和代码复制粘贴进来完全没有应用糊弄人的垃圾半成品论文。 B题论…

详解drop,delete,truncate区别

在SQL中&#xff0c;"DROP"、"DELETE"和"TRUNCATE"是用于删除数据的不同命令&#xff0c;它们之间有一些重要的区别&#xff1a; DROP&#xff1a; DROP用于删除数据库对象&#xff0c;例如删除表、视图、索引、触发器等。使用DROP删除的对象将…

C++相关概念和易错语法(11)(npos、string的基本使用)

本文主要是分享一些基础的用法和接口&#xff0c;不会涉及迭代器版本&#xff0c;也没有底层概念&#xff0c;主要是保证简单入门和使用。 1.npos string本质上是一个类&#xff0c;里面包含了上百个成员函数&#xff0c;在调用这个头文件后&#xff0c;我们要知道整个类都被…

unity制作app(5)--发送数据给数据库

这个之前做过&#xff0c;先不做照片的。下一节再做带照片的。 第一步 收集数据 1.先做一个AppModel结构体&#xff0c;这个结构体需要单做的。 using System; using System.Collections.Generic; using System.Linq; using System.Text; //using Assets.Model; public clas…

LangChain连接国内大模型测试|智谱ai、讯飞星火、通义千问

智谱AI 配置参考 https://python.langchain.com/v0.1/docs/integrations/chat/zhipuai/ZHIPUAI_API_KEY从https://open.bigmodel.cn/获取 from langchain_community.chat_models import ChatZhipuAI from langchain_core.messages import AIMessage, HumanMessage, SystemMes…

Lambda表达式Stream流-函数式编程入门教程

目录 函数式编程思想 Lambda 表达式 Stream流 常用的Stream中的API 创建Stream 第一种是直接使用.Stream()的方式来创建 第二种采用.of()方式创建 具体来看看每一个API是怎么用的 concat max min findFirst findAny count peek forEach forEachOrdered skip d…

oracle 9i 行头带有scn的表

oracle 9i 行头带有scn的表 conn scott/tiger drop table t1; drop table t2; create table t1(c varchar2(5)); create table t2(c varchar2(6)) ROWDEPENDENCIES; --t2表每行都有scn,会增加六个字节的开销 alter table t1 pctfree 0; alter table t2 pctfree 0; insert in…

Array.map解析

map方法会创建一个新数组。该方法会循环数组中的每个值&#xff0c;如果仅仅是想循环数组不需要返回值使用数组的forEach方法就可以。原数组中的每个元素都调用一次提供的函数后的返回值组成。Array.map 它接收一个函数 这个函数可以接收三个参数 数组的每个值item 这个值的索引…

2016-2021年全国范围的2.5m分辨率的建筑屋顶数据

一、论文介绍 摘要&#xff1a;大规模且多年的建筑屋顶面积&#xff08;BRA&#xff09;地图对于解决政策决策和可持续发展至关重要。此外&#xff0c;作为人类活动的细粒度指标&#xff0c;BRA可以为城市规划和能源模型提供帮助&#xff0c;为人类福祉带来好处。然而&#xf…

【html项目】教你制作地表最强王者辅助网站装逼神器

今天如何教你们写教你们如何写一个 仿王者荣耀修改器装逼神器 效果图 html: <body><header> <a href"//pvp.qq.com/" class"qqq" title"王者荣耀" onclick"PTTSendClick(link,logo,logo);">王者荣耀</a>&l…

信息系统架构模型_2.面向服务架构(SOA)模式

前面讲的客户机/服务器模式&#xff0c;无论多少层的C/S软件结构&#xff0c;对外来讲&#xff0c;都只是一个单结点应用&#xff08;无论它由多个不同层的“服务”相互配合来完成其功能&#xff09;&#xff0c;具体表现为一个门户网站、一个应用系统等。而多个单点应用相互通…