欢迎来到天天文库
浏览记录
ID:57574638
大小:85.50 KB
页数:31页
时间:2020-08-27
《学生信息管理系统-系统源代码.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、系统源代码一、登录界面代码usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingusingusingusingusingusingpublicpartialclasslogin:{protectedvoidtxtid_Click(objectsender,EventArgse){txtid.Text="";txtpassword.Text="";}protectedvoidButton1_
2、Click(objectsender,EventArgse){stringstrconn=ConfigurationManager.AppSettings["connStr"];SqlConnectionconn=newSqlConnection(strconn);conn.Open();DataSetds=newDataSet();SqlDataAdapterda=newSqlDataAdapter("select*fromuserswhereuserid='"+txtid.Text+"'anduserpwd='"+txtpass
3、word.Text+"'",conn);da.Fill(ds);if(ds.Tables[0].Rows.Count==0){Label3.Text="账号或密码错误,请重新输入!";}else{Session["userid"]=txtid.Text;Session["userpwd"]=txtpassword.Text;Session["username"]=ds.Tables[0].Rows[0]["username"].ToString();Session["userpower"]=ds.Tables[0].Rows[0][
4、"userpower"].ToString();if(Session["userpower"].ToString()=="0"){Response.Redirect("admin/index.aspx");}elseif(Session["userpower"].ToString()=="1"){Response.Redirect("student/index.aspx");}else{Label3.Text="对不起,权限验证失败";}}conn.Close();ds.Clear();}}二、添加课程页面代码usingSystem
5、;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingusingusingusingusingusingpublicpartialclassaddcourse:{SqlCommandmycmd;SqlConnectionconn;protectedvoidPage_Load(objectsender,EventArgse){"checkcourseid()");stringstrconn=Configurati
6、onManager.AppSettings["connStr"];conn=newSqlConnection(strconn);}protectedvoidButton1_Click(objectsender,EventArgse){if==""){Label7.Text="课程号不能为空";}else{stringsqlstr="";sqlstr="insertintocourse(courseid,coursename,coursetime,fen,type,teacher)values('"+courseid.Text+"',
7、'"+coursename.Text+"','"+coursetime.Text+"','"+fen.Text+"','"+type.Text+"','"+teacher.Text+"')";conn.Open();mycmd=newSqlCommand(sqlstr,conn);mycmd.Dispose();try{mycmd.ExecuteNonQuery();Response.Write("");}catch(SqlException)
8、{Response.Write("");}finally{conn.Close();sqlstr="";}}}protectedvoidButt
此文档下载收益归作者所有