学生信息管理系统 系统源代码

上传人:z****2 文档编号:199019667 上传时间:2023-04-10 格式:DOCX 页数:43 大小:65.84KB
收藏 版权申诉 举报 下载
学生信息管理系统 系统源代码_第1页
第1页 / 共43页
学生信息管理系统 系统源代码_第2页
第2页 / 共43页
学生信息管理系统 系统源代码_第3页
第3页 / 共43页
资源描述:

《学生信息管理系统 系统源代码》由会员分享,可在线阅读,更多相关《学生信息管理系统 系统源代码(43页珍藏版)》请在装配图网上搜索。

1、系统源代码一、登录界面代码using System ;using System 。 Data;using System.Configuration;using System.Collections ;using System。Web ;using System.Web 。 Security ;using System 。 Web。 UI;using System.Web 。 UI。 WebControls;using System 。 Web。 UI。 WebControls.WebParts;using System.Web.UI 。 HtmlControls ;using System 。

2、 Data 。 SqlClient;public partial class login : System 。 Web。 UI.Pageprotected void txtid_Click (object sender , EventArgs e ) txtid.Text = ;txtpassword 。 Text = ;protected void Button1_Click(object sender, EventArgs e )”connStr ;from users where userid=”, conn ) ;string strconn = ConfigurationManage

3、r 。 AppSettings SqlConnection conn = new SqlConnection(strconn) ; conn 。 Open ();DataSet ds=new DataSet () ;SqlDataAdapter da = new SqlDataAdapter (”select + txtid 。 Text + ” and userpwd=” + txtpassword 。 Text + ” da.Fill (ds);if ( ds 。 Tables 0 .Rows.Count=0 )Label3。Text =账号或密码错误,请重新输入!”;elseSessio

4、n ”userid” =txtid 。 Text ;Session ”userpwd” = txtpassword 。 Text;Session”username = ds 。 Tables0。 Rows0”username” 。 ToString );Sessionuserpower = ds.Tables0 。 Rows0userpower” .ToString);if (Session ”userpower” 。 ToString () = 0” )Response 。 Redirect(”admin/index.aspx” );else if (Session ”userpower”.

5、ToString () = 1 )Response.Redirect (”student/index 。 aspx” );elseLabel3 。 Text = ” 对不起,权限验证失败 ;conn.Close ();ds 。 Clear ( );二、添加课程页面代码using System ;using System。Data ;using System。Configuration ; using System 。 Collections;using System.Web ;using System.Web.Security ; using System 。 Web 。 UI; using

6、System.Web 。 UI.WebControls;using System.Web 。 UI。 WebControls 。 WebParts;using System.Web 。 UI.HtmlControls ; using System.Data 。 SqlClient;public partial class addcourse : System 。 Web 。 UI.PageSqlCommand mycmd ;SqlConnection conn ; protected void Page_Load(object sender , EventArgs e )courseid.At

7、tributes 。 Add (onblur , ”checkcourseid( )”);string strconn = ConfigurationManager 。 AppSettings ”connStr ; conn = new SqlConnection(strconn);protected void Button1_Click ( object sender, EventArgs e)if (courseid 。 Text。 ToString () = ”)Label7 。 Text = 课程号不能为空 ;elsestring sqlstr = ” sqlstr = insert

8、into course ( courseid ,coursename ,coursetime ,fen,type,teacher)values ( + courseid 。 Text + ”, + coursename 。 Text + ”, +coursetime.Text + ” , ” + fen。Text + ”,” + type 。Text + ” , + t eacher.Text + ); conn.Open () ;mycmd = new SqlCommand(sqlstr, conn);mycmd.Dispose( );trymycmd 。 ExecuteNonQuery (

9、);Response 。 Write ( scriptjavascript : alert( 添加成功! ! );” );catch (SqlException)Response Write(scriptjavascript:alert(添加失败!!);/script); finallyconn。Close ();sqlstr = ” ;protected void Button2_Click ( object sender , EventArgs e )courseid.Text = ” ;coursename.Text = ” ; coursetime 。 Text = ”;fen.Tex

10、t = ;type 。 Text = ” ;protected void Button3_Click ( object sender, EventArgs e)Response 。 Redirect ( ”course 。 aspx”);三、添加成绩程序代码using System;using System 。 Data;using System.Configuration ;using System.Collections;using System 。 Web;using System.Web 。 Security ;using System 。Web。UI ;using System 。W

11、eb。 UI.WebControls ;using System 。Web 。 UI。 WebControls 。 WebParts ;using System 。Web.UI.HtmlControls ;using System.Data 。 SqlClient ;public partial class addscore : System 。 Web 。 UI。 Page SqlCommand mycmd;SqlConnection conn ;protected void Page_Load ( object sender , EventArgs e )”connStr”;string

12、strconn = ConfigurationManager 。 AppSettings conn = new SqlConnection (strconn ) ;protected void Button1_Click ( object sender, EventArgs e) if (userid 。 SelectedValue .ToString ()= ”)elsestring sqlstr = ” ;sqlstr = insert into score ( userid ,username ,courseid ,coursename ,score,year ) values (” +

13、 userid。SelectedValue + , + username。Text + , + txtcourseid 。 SelectedValue + ” , ” + coursename。Text + , ” + score。Text + , ” + txtyear.SelectedValue + ”) ”;conn 。 Open ();mycmd = new SqlCommand ( sqlstr, conn ) ;mycmd 。 Dispose( );trymycmd.ExecuteNonQuery ();Response 。 Write(”script javascript :al

14、ert( 添加成功 !!);/script ”); catch ( SqlException)Response.Write ( scriptjavascript : alert(添加失败! ! !) ; /script)finallyconn 。 Close( );sqlstr = ”;protected void Button2_Click ( object sender , EventArgs e )username 。 Text = ;coursename 。 Text = ”;score 。 Text = ”;txtyear.Text = ;protected void Button3

15、_Click(object sender , EventArgs e )Response。Redirect (score。aspx);protected void userid_SelectedIndexChanged ( object sender , EventArgs e )string sqlstr = ” ;sqlstr = ”select username from students where userid=” + userid 。 SelectedValue + ” ;conn.Open () ;mycmd = new SqlCommand ( sqlstr , conn) ;

16、mycmd 。 Dispose ( );SqlDataReaderda;da = mycmd.ExecuteReader ();while ( da。 Read( )username.Text = da username” 。 ToString ( );protected void txtcourseid_SelectedIndexChanged ( object sender, EventArgs e)string sqlstr = ” ;sqlstr = ”select coursename from course where courseid=” + txtcourseid 。Selec

17、tedValue + ”;conn 。 Open ( ); mycmd = new SqlCommand ( sqlstr , conn) ; mycmd 。 Dispose( );SqlDataReader da;da = mycmd 。 ExecuteReader( );while (da。Read()coursename 。 Text = da coursename” 。 ToString( ) ;四、添加学生程序代码using System ;using System.IO ;using System 。Text;using System 。Data;using System 。Con

18、figuration ;using System 。Collections ;using System 。Web;using System 。Web.Security;using System.Web.UI ;using System 。Web 。 UI.WebControls ;using System 。Web 。 UI.WebControls 。 WebParts;using System 。Web.UI.HtmlControls ;using System 。Data.SqlClient ;public partial class addstudent : System 。 Web.U

19、I 。 Page SqlCommand mycmd ;protected void Page_Load ( object sender , EventArgs e) userid 。 Attributes 。 Add ( ”onblur”, checkuserid()”); string strconn = ConfigurationManager 。 AppSettings connStr” ;SqlConnection conn = new SqlConnection( strconn);protected void Button1_Click ( object sender , Even

20、tArgs e )if (userid 。 Text.ToString () = )return;string strconn = ConfigurationManager 。 AppSettings connStr” ;SqlConnection conn = new SqlConnection( strconn) ;string sqlstr = ”;string sql = ;sqlstr = ”insert into students(userid, username , sex,minzu ,birthday,class,comefrom,beizhu ,xuey ,zhuany,t

21、el ,idc,zhengzmm ,zhiw ,huoj ,weij)values(” + userid。Text + ” , + txtusername。Text + ” , ” + txtsex。SelectedItem。Value + ”, + txtminzu 。 Text + , ” + txtbirthday 。 Text + , ” + txtclass.Text + ”, ” +txtcomefrom 。 Text + ” , ” + txtbeizhu.Text + , + txtxuey 。 SelectedValue + , ” + txtzhuany.SelectedV

22、alue + , + txttel 。 Text + , + txtidc 。 Text + ” , ” +txtzzmm.SelectedValue + , ” + txtzhiw.Text + ” , ” + txthuoj 。 Text + ”, ” + txtweij 。 Text + ) ;conn.Open ( );mycmd = new SqlCommand ( sqlstr ,conn);mycmd 。 Dispose ( );string name = this 。 FileUpload1 。 FileName ; / 获取上传文件的名称string type = name

23、。 Substring ( name.LastIndexOf ( ”) + 1 ); /获取上传文 件的后缀string ipath = Server 。 MapPath ( ”images/ ) + DateTime 。Now.ToString(yyyyMMddhhmmss”) + name;string wpath = images ” + DateTime 。 Now.ToString ( ”yyyyMMddhhmmss”) + name;string query1 = ”insert into images (userid,path ) values ( + userid 。 Text

24、 + , path) ”;FileUpload1.SaveAs(ipath );/ 服务器保存路径SqlCommand cm = new SqlCommand ( query1 );cm.Connection = conn;cm。Parameters。Add(” path, SqlDbType。VarChar, 50 );cm.Parameters path”。 Value = wpath;cm.ExecuteNonQuery ();/ this 。 lb_info 。 Text = ” 上传成功 ! ;trymycmd 。 ExecuteNonQuery ( );string sqlstr1

25、 = ” ;sqlstrl = insert into users(userid,username)values (” + userid。Text + , + txtusername Text + )”;SqlCommand mycmdl = new SqlCommand ( sqlstrl , conn ); mycmdl 。 Dispose() ;trymycmdl.ExecuteNonQuery() ;Response 。 Write (scriptjavascript :alert (添加成功! !) ;/script ”);catch ( SqlException )Response

26、 。 Write(”javascript:alert ( 添加失败 !!); 该课程号已经存在,请换一个 /b ) elseResponse.Write( 该学号可以使用/b”);dr。Close ( );七、课程信息程序代码using System;using System 。Data;using System 。Configuration ;using System 。Collections ;using System 。Web;using System 。Web 。 Security;using System.Web 。 UI;using System 。 Web.UI 。WebCont

27、rols ;using System.Web 。 UI。WebControls 。 WebParts ;using System.Web 。 UI。HtmlControls;using System 。 Data.SqlClient ;public partial class courseSystem 。 Web.UI 。 PageSqlConnection conn ;SqlDataReader getdata;protected void Page_Load(object sender , EventArgs e)string strconn = ConfigurationManager.

28、AppSettingsconnStr” ;conn = new SqlConnection(strconn );SqlDataReader getdata ;SqlCommand mycmd ;DataSet ds = new DataSet ( );string sql = ;sql = ”select * from course order by courseid;mycmd = new SqlCommand(sql, conn );conn 。 Open( ) ;getdata = mycmd 。 ExecuteReader ();grdMain 。 DataSource = getda

29、ta ;grdMain 。 DataBind ( );mycmd 。 Connection.Close ();conn.Close ();mycmd 。 Dispose ();protected void Button1_Click(object sender , EventArgs e)DataSet ds ;SqlDataReader da ;string strsql = ” ;SqlCommand cmd;conn 。 Open();strsql = ”select * from course where courseid=” + courseid。 Text + orcoursena

30、me like + coursename.Text + ” ;cmd = new SqlCommand(strsql , conn );da = cmd。ExecuteReader ();Datagrid1 。 DataSource = da;Datagrid1.DataBind ();conn.Close ();cmd 。 Dispose( ) ;cmd.Connection 。 Close ();八、编辑、删除学生信息程序代码using System ;using System 。Data ;using System 。Configuration ;using System 。Collec

31、tions;using System.Web ;using System 。 Web.Security;using System.Web。UI ;using System 。Web.UI。 WebControls ;using System 。Web.UI 。 WebControls.WebParts ;using System 。Web.UI.HtmlControls ;using System 。Data.SqlClient ;public partial class images_editstudent : System 。 Web。 UI。 PageSqlCommand cmd;Sql

32、Command cmd2 ;protected void Page_Load ( object sender, EventArgs e )if ( !this.IsPostBack)string sql = ”SqlDataReader reader;string uid = ”。 AppSettings”connStr” ;uid = Page 。 Request”id ;string strconn = ConfigurationManagerSqlConnection conn = new SqlConnection(strconn );sql = ”select from stude

33、nts where userid=” + uid + ”SqlCommand cmd ;cmd = new SqlCommand(sql , conn) ;conn。Open ();reader = cmd.ExecuteReader();while ( reader 。 Read ()userid 。 Text = reade r”userId” 。 ToString ( );txtusername 。 Text = reader”username” .ToString (); txtsex 。 SelectedValue = reader ”sex” .ToString( ); txtmi

34、nzu 。 Text = reader”minzu .ToString (); txtbirthday.Text = reader ”birthday”.ToString (); txtclass 。 Text = reader”class 。 ToString () ; txtcomefrom 。 Text = readercomefrom” 。 ToString( ); txtxuey.Text = reader ”xuey”.ToString ( );txtzhuany 。 Text = reader ”zhuany” 。 ToString (); txttel 。 Text = rea

35、der tel 。 ToString () ; txtidc 。 Text = reader idc 。 ToString();cmd.Dispose ( );sql = ;conn.Close( );protected void Button1_Click(object sender , EventArgs e)string uid=” ;uid=Page 。 Request ”id;string strconn = ConfigurationManager.AppSettings ”connStr” ;SqlConnection conn = new SqlConnection(strco

36、nn ) ;string sql=” ;sql = ”update students set userid=” + userid 。 Text + , username=” + txtusername.Text + , minzu= + txtminzu 。 Text + , sex=” + txtsex 。 SelectedItem 。+ txtcomefrom. Text + ”,beizhu= + txtbeizhu.Text + ”, xuey=” + txtxuey.Text + ”,zhuany=” + txtzhuany.Text + ,tel=” + txttel.Text +

37、 ”, idc=” + txtidc 。 Text+ ”,zhengzmm= + txtzzmm 。 SelectedValue + ”where userid=” + uid + ;cmd=new SqlCommand (sql, conn );conn 。 Open( );trycmd.ExecuteNonQuery( );Label11 。 Style”color” = blue” ;Label11.Text = 编辑成功 ”;Response 。 Write(”javascript:alert( 编辑成功 !!!); );catch(SqlException )Label11.Text

38、 = ” 编辑失败 ;Label11 。 Style color” = ”red” ;cmd 。 Dispose ();conn 。 Close ( );protected void Button2_Click ( object sender , EventArgs e )string sql = ;string uid = ”;string sqlall = ” ;uid = Page 。 Requestid” ;string strconn = ConfigurationManager.AppSettings”connStr ;SqlConnection conn = new SqlCon

39、nection(strconn );sql = ”delete from students where userid= + uid + ”;sqlall = ”delete from images where userid=” + uid + ”;cmd = new SqlCommand(sql, conn) ; cmd2 = new SqlCommand(sqlall ,conn ); conn 。 Open( );trycmd.ExecuteNonQuery ();string sql1 = ”;sql1 = delete from users where userid= + uid +

40、”;SqlCommand cmd1 = new SqlCommand(sql1 , conn );cmd1.Dispose() ;trycmd1 。 ExecuteNonQuery ();Label11.Style”color = ”blue” ;Label11.Text = 删除成功 ”;Response。Write ( scriptjavascript : alert(删除成功! ! !); /script”);catch ( SqlException )Label11 。 Text = ” 删除失败 ”;Response 。 Write ( script javascript : ale

41、rt( 删除失败!!);/script” );finallysql1 = ” ;catch ( SqlException )Label11.Text = 删除失败 ;Label11.Style color = red;cmd.Dispose( ); conn.Close ( ); userid 。 Text = ;txtusername 。 Text = ” ; txtminzu 。 Text = ” ; txtbirthday 。 Text = ”; txtclass.Text = ” ;txtcomefrom.Text = ” ; txtbeizhu 。 Text = ” ; txtxue

42、y 。 Text = ” ; txtzhuany 。 Text = ” ; txttel 。 Text = ” ; txtidc.Text = ”;protected void Button3_Click(object sender, EventArgs e ) Response。Redirect(student。aspx);九、编辑、删除课程信息程序代码 using System;using System 。 Data ;using System 。 Configuration ;using System.Collections ; using System 。 Web;using Syst

43、em.Web.Security; using System 。 Web.UI ; using System.Web.UI.WebControls;using System。Web。UI。WebControls.WebParts ;using System.Web 。 UI。 HtmlControls ;using System 。 Data.SqlClient ;public partial class editcourse : System 。 Web。 UI.PageSqlCommand cmd;protected void Page_Load ( object sender, Event

44、Args e )if (! this 。 IsPostBack )string sql = ” ;SqlDataReader reader ;string uid = ” ;uid = Page 。 Request ”id ;string strconn = ConfigurationManager.AppSettings ”connStr” ; SqlConnection conn = new SqlConnection(strconn ); sql = ”select * from course where courseid= + uid + ”;SqlCommand cmd ;cmd =

45、 new SqlCommand (sql, conn );conn.Open ();reader = cmd 。 ExecuteReader( );while (reader.Read( )courseid 。 Text = reader”courseid” 。 ToString( ); coursename.Text = reader coursename” 。 ToString( ); coursetime.Text = readercoursetime” 。 ToString ();fen 。 Text = readerf en” 。 ToString() ;type 。 Text =

46、reader type 。 ToString( );type 。 Text = reader ”teacher” 。 ToString();cmd。Dispose();sql = ;conn 。 Close ();protected void Button1_Click(object sender , EventArgs e )string uid = ”;uid = Page.Request ”id” ;string strconn = ConfigurationManager 。 AppSettingsconnStr ;SqlConnection conn = new SqlConnect

47、ion ( strconn);string sql = ”;sql = ”update course set courseid=” + courseid 。 Text + ,coursename= + coursename 。 Text + ” ,coursetime= + coursetime 。 Text + ” ,fen= + fen.Text + ”,type=” + type 。 Text + , teacher= + teacher.Text + ” where courseid= + uid + ”;cmd = new SqlCommand (sql, conn ) ;conn.

48、Open ( );trycmd.ExecuteNonQuery( );Label7 。 Text = ” 编辑成功 ;Response.Write (javascript : alert (删除成功!); v/script );catch (SqlException )Label7 。 Text = ” 删除失败 ;cmd 。 Dispose ( ); conn.Close ( ); courseid 。 Text = ” ;coursename 。 Text = ”;coursetime.Text = ”;fen。 Text = ”;type 。 Text = ;EventArgs e )p

49、rotected void Button3_Click(object senderResponse 。 Redirect ( ”course.aspx” ) ;十、编辑、删除成绩信息程序代码using System ;using System.Data;using System.Configuration ;using System 。Collections;using System 。Web;using System 。Web。Security;using System 。Web.UI;using System.Web 。UI.WebControls ;using System.Web 。U

50、I.WebControls.WebPartsusing System.Web 。UI 。 HtmlControls;using System.Data 。SqlClient ;public partial class editscore : System 。 Web。 UI。 PageSqlCommand cmd;SqlConnection conn ;protected void Page_Load(object sender , EventArgs e )if ( !this 。 IsPostBack )string sql = ”;SqlDataReader reader;string

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!