论文无忧网提供:计算机毕业论文范文|计算机毕业设计|计算机毕业论文
栏目导航 ASP Java Web .NET VB6.0 JAVA VC VF DELPHI PB 计算机网络 计算机科学与技术 PHP 安卓APP 其他 C# 代写论文
当前位置: > 计算机 > .NET >

(C)学生管理系统论文

  4主要界面及相关代码

4.1学生管理系统首页

http://www.paper51.com

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

paper51.com

代码入下

copyright paper51.com

using System;

paper51.com

using System.Collections;

http://www.paper51.com

using System.ComponentModel; copyright paper51.com

using System.Data;

paper51.com

using System.Data.SqlClient;

paper51.com

using System.Drawing;

内容来自论文无忧网 www.paper51.com

using System.Web;

http://www.paper51.com

using System.Web.SessionState; 内容来自www.paper51.com

using System.Web.UI;

http://www.paper51.com

using System.Web.UI.WebControls; 内容来自论文无忧网 www.paper51.com

using System.Web.UI.HtmlControls; copyright paper51.com

using System.Configuration;

copyright paper51.com

namespace sms

copyright paper51.com

{

内容来自www.paper51.com

     public class _default: System.Web.UI.Page 内容来自论文无忧网 www.paper51.com

     { paper51.com

         protected System.Web.UI.WebControls.TextBoxTbx_userid; http://www.paper51.com

         protected System.Web.UI.WebControls.TextBoxTbx_userpwd;

内容来自www.paper51.com

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

内容来自www.paper51.com

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

内容来自www.paper51.com

          private voidPage_Load(object sender, System.EventArgs e) 内容来自论文无忧网 www.paper51.com

         { 内容来自www.paper51.com

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

http://www.paper51.com

         }

内容来自论文无忧网 www.paper51.com

         #region Web Form Designer generated code copyright paper51.com

         override protected void OnInit(EventArgs e)

内容来自论文无忧网 www.paper51.com

         { 内容来自论文无忧网 www.paper51.com

              // paper51.com

              // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。 内容来自www.paper51.com

              // http://www.paper51.com

              InitializeComponent();

内容来自论文无忧网 www.paper51.com

              base.OnInit(e); paper51.com

         }

copyright paper51.com

         private voidInitializeComponent() paper51.com

         {    copyright paper51.com

              this.Btn_enter.Click += newSystem.EventHandler(this.Btn_enter_Click);

内容来自论文无忧网 www.paper51.com

              this.Load += newSystem.EventHandler(this.Page_Load); 内容来自论文无忧网 www.paper51.com

         }

copyright paper51.com

         #endregion

内容来自论文无忧网 www.paper51.com

         private voidBtn_enter_Click(object sender, System.EventArgse) http://www.paper51.com

         {

http://www.paper51.com

              string strconn=ConfigurationSettings.AppSettings["dsn"]; http://www.paper51.com

              SqlConnectioncn=new SqlConnection(strconn);   paper51.com

              cn.Open();

http://www.paper51.com

              string strsql="select * from users whereUser_id='"+Tbx_userid.Text+"'andUser_password='"+Tbx_userpwd.Text+"'"; http://www.paper51.com

              SqlCommandcm=new SqlCommand(strsql,cn);

内容来自www.paper51.com

              SqlDataReaderdr=cm.ExecuteReader(); http://www.paper51.com

              if(dr.Read()) 内容来自论文无忧网 www.paper51.com

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

copyright paper51.com

                   Session["user_power"]=dr["User_power"];            copyright paper51.com

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

copyright paper51.com

                   { http://www.paper51.com

                       Response.Redirect("query.aspx"); 内容来自www.paper51.com

                   }

paper51.com

                   else 内容来自论文无忧网 www.paper51.com

                   {

内容来自www.paper51.com

                       Response.Redirect("student.aspx"); paper51.com

                   }

paper51.com

              } copyright paper51.com

              else http://www.paper51.com

              { 内容来自www.paper51.com

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

http://www.paper51.com

                } 内容来自www.paper51.com

              cn.Close(); copyright paper51.com

          }

内容来自论文无忧网 www.paper51.com

        

copyright paper51.com

     }

内容来自论文无忧网 www.paper51.com

} 内容来自论文无忧网 www.paper51.com

4.2学生班级管理维护页面

内容来自www.paper51.com

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

http://www.paper51.com

内容来自www.paper51.com

代码如下: 内容来自论文无忧网 www.paper51.com

using System;

http://www.paper51.com

using System.Collections; paper51.com

using System.ComponentModel;

内容来自论文无忧网 www.paper51.com

using System.Data;

内容来自论文无忧网 www.paper51.com

using System.Data.SqlClient;

paper51.com

using System.Drawing; paper51.com

using System.Web;

内容来自论文无忧网 www.paper51.com

using System.Web.SessionState; 内容来自论文无忧网 www.paper51.com

using System.Web.UI; 内容来自论文无忧网 www.paper51.com

using System.Web.UI.WebControls;

http://www.paper51.com

using System.Web.UI.HtmlControls; 内容来自www.paper51.com

using System.Configuration;

copyright paper51.com

namespace sms

paper51.com

{

内容来自论文无忧网 www.paper51.com

     /// <summary>

copyright paper51.com

     /// student 的摘要说明。 paper51.com

     /// </summary>

内容来自www.paper51.com

     public class student: System.Web.UI.Page http://www.paper51.com

     {

copyright paper51.com

         protected System.Web.UI.WebControls.LinkButtonLbtn_course; paper51.com

         protected System.Web.UI.WebControls.LinkButtonLbtn_sortcourse;

内容来自论文无忧网 www.paper51.com

         protected System.Web.UI.WebControls.DataGridDgd_student; 内容来自论文无忧网 www.paper51.com

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

内容来自论文无忧网 www.paper51.com

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

http://www.paper51.com

         protected System.Web.UI.WebControls.TextBoxTbx_sortid;

内容来自论文无忧网 www.paper51.com

         protected System.Web.UI.WebControls.Button Btn_ok; http://www.paper51.com

         SqlConnectioncn; http://www.paper51.com

         protected System.Web.UI.WebControls.Button Btn_search; http://www.paper51.com

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

paper51.com

         protected System.Web.UI.WebControls.LinkButtonLbtn_add; paper51.com

         protected System.Web.UI.WebControls.TextBox Tbx_name; copyright paper51.com

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

http://www.paper51.com

         protected System.Web.UI.WebControls.LinkButtonLbtn_grade;

内容来自www.paper51.com

         protected System.Web.UI.WebControls.LinkButtonLbtn_addclass; 内容来自论文无忧网 www.paper51.com

         protected System.Web.UI.WebControls.LinkButtonLbtn_addteacher; 内容来自论文无忧网 www.paper51.com

         protected System.Web.UI.WebControls.LinkButtonLbtn_student;

内容来自www.paper51.com

         string strsql;

paper51.com

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

copyright paper51.com

         { http://www.paper51.com

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

              cn=new SqlConnection(strconn);  

http://www.paper51.com

              if(!IsPostBack) copyright paper51.com

              Bindgrid(); http://www.paper51.com

         } http://www.paper51.com

         #region Web Form Designer generated code 内容来自论文无忧网 www.paper51.com

         override protected void OnInit(EventArgs e)

copyright paper51.com

         {

http://www.paper51.com

              InitializeComponent();

内容来自www.paper51.com

              base.OnInit(e); http://www.paper51.com

         } http://www.paper51.com

        

内容来自论文无忧网 www.paper51.com

         private voidInitializeComponent()

copyright paper51.com

         {    内容来自论文无忧网 www.paper51.com

              this.Lbtn_addclass.Click += newSystem.EventHandler(this.Lbtn_addclass_Click);

内容来自www.paper51.com

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

              this.Lbtn_course.Click += newSystem.EventHandler(this.Lbtn_course_Click);

paper51.com

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

内容来自www.paper51.com

              this.Lbtn_grade.Click += newSystem.EventHandler(this.Lbtn_grade_Click);

内容来自论文无忧网 www.paper51.com

              this.Btn_search.Click += newSystem.EventHandler(this.Btn_search_Click);

copyright paper51.com

              this.Btn_ok.Click += newSystem.EventHandler(this.Btn_ok_Click);

copyright paper51.com

              this.Lbtn_add.Click += newSystem.EventHandler(this.Lbtn_add_Click); paper51.com

              this.Btn_all.Click += newSystem.EventHandler(this.Btn_all_Click);

http://www.paper51.com

              this.Btn_exit.Click += newSystem.EventHandler(this.Btn_exit_Click); 内容来自www.paper51.com

              this.Load += newSystem.EventHandler(this.Page_Load);

paper51.com

         }

paper51.com

         #endregion

copyright paper51.com

         private voidBtn_search_Click(object sender,System.EventArgs e) http://www.paper51.com

         {  paper51.com

              Pnl_sort.Visible=true; 内容来自论文无忧网 www.paper51.com

         } paper51.com

         private voidBtn_all_Click(object sender, System.EventArgse)

内容来自论文无忧网 www.paper51.com

         {  copyright paper51.com

              paper51.com

              Pnl_sort.Visible=false; paper51.com

              Bindgrid(); http://www.paper51.com

             

内容来自www.paper51.com

     }

内容来自www.paper51.com

         public voidDataGrid_Page(objectsender,DataGridPageChangedEventArgs e) copyright paper51.com

         { paper51.com

              Dgd_student.CurrentPageIndex=e.NewPageIndex;

http://www.paper51.com

              Bindgrid(); 内容来自www.paper51.com

         } copyright paper51.com

         public voidDataGrid_cancel(objectsender,DataGridCommandEventArgs e) http://www.paper51.com

         { http://www.paper51.com

             

内容来自论文无忧网 www.paper51.com

              Dgd_student.EditItemIndex=-1;

paper51.com

              Bindgrid(); 内容来自论文无忧网 www.paper51.com

             

paper51.com

         }

paper51.com

         public voidDataGrid_edit(objectsender,DataGridCommandEventArgs e)

内容来自论文无忧网 www.paper51.com

         {

copyright paper51.com

              内容来自www.paper51.com

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

        

内容来自论文无忧网 www.paper51.com

                   Bindgrid(); http://www.paper51.com

             

http://www.paper51.com

         }

内容来自www.paper51.com

         public voidDataGrid_update(objectsender,DataGridCommandEventArgs e) 内容来自论文无忧网 www.paper51.com

         { 内容来自论文无忧网 www.paper51.com

              string strsql="update student setStudent_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_elsewhere Student_id=@Student_id"; 内容来自论文无忧网 www.paper51.com

              SqlCommandcm=new SqlCommand(strsql,cn); copyright paper51.com

              try

paper51.com

              { paper51.com

              cm.Parameters.Add(newSqlParameter("@Student_name",SqlDbType.VarChar,50)); http://www.paper51.com

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

http://www.paper51.com

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

paper51.com

              cm.Parameters.Add(newSqlParameter("@Student_birthday",SqlDbType.DateTime,8)); 内容来自www.paper51.com

              cm.Parameters.Add(newSqlParameter("@Student_time",SqlDbType.DateTime,8)); http://www.paper51.com

              cm.Parameters.Add(newSqlParameter("@Student_classid",SqlDbType.VarChar,50)); copyright paper51.com

              cm.Parameters.Add(new SqlParameter("@Student_home",SqlDbType.VarChar,50)); http://www.paper51.com

              cm.Parameters.Add(newSqlParameter("@Student_else",SqlDbType.VarChar,50)); paper51.com

              cm.Parameters.Add(newSqlParameter("@Student_id",SqlDbType.VarChar,50)); 内容来自www.paper51.com

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

paper51.com

              cm.Parameters["@Student_name"].Value=colvalue; http://www.paper51.com

              colvalue=((TextBox)e.Item.Cells[2].Controls[0]).Text; http://www.paper51.com

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

http://www.paper51.com

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

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

http://www.paper51.com

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

内容来自www.paper51.com

              cm.Parameters["@Student_birthday"].Value=colvalue; 内容来自www.paper51.com

              colvalue=((TextBox)e.Item.Cells[5].Controls[0]).Text; http://www.paper51.com

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

内容来自www.paper51.com

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

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

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

内容来自论文无忧网 www.paper51.com

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

内容来自www.paper51.com

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

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

内容来自www.paper51.com

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

http://www.paper51.com

              cm.Connection.Open();           

paper51.com

                   cm.ExecuteNonQuery(); http://www.paper51.com

                   Lbl_note.Text="编辑成功"; 内容来自论文无忧网 www.paper51.com

                   Dgd_student.EditItemIndex=-1;

http://www.paper51.com

              }

http://www.paper51.com

              catch

内容来自www.paper51.com

              {

内容来自论文无忧网 www.paper51.com

                   Lbl_note.Text="编辑失败,请检查输入!"; 内容来自www.paper51.com

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

copyright paper51.com

              }

http://www.paper51.com

              cm.Connection.Close();      http://www.paper51.com

              Bindgrid();

内容来自论文无忧网 www.paper51.com

              http://www.paper51.com

         }

paper51.com

           http://www.paper51.com

------分隔线----------------------------
联系方式