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

上传人:b****3 文档编号:5441179 上传时间:2022-12-16 格式:DOCX 页数:33 大小:19.49KB
下载 相关 举报
学生信息管理系统 系统源代码.docx_第1页
第1页 / 共33页
学生信息管理系统 系统源代码.docx_第2页
第2页 / 共33页
学生信息管理系统 系统源代码.docx_第3页
第3页 / 共33页
学生信息管理系统 系统源代码.docx_第4页
第4页 / 共33页
学生信息管理系统 系统源代码.docx_第5页
第5页 / 共33页
点击查看更多>>
下载资源
资源描述

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

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

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

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

系统源代码

一、登录界面代码

usingSystem;

usingSystem.Data;

usingSystem.Configuration;

usingSystem.Collections;

usingSystem.Web;

usingSystem.Web.Security;

usingSystem.Web.UI;

usingSystem.Web.UI.WebControls;

usingSystem.Web.UI.WebControls.WebParts;

usingSystem.Web.UI.HtmlControls;

usingSystem.Data.SqlClient;

publicpartialclasslogin:

System.Web.UI.Page

{

protectedvoidtxtid_Click(objectsender,EventArgse)

{

txtid.Text="";

txtpassword.Text="";

}

protectedvoidButton1_Click(objectsender,EventArgse)

{

stringstrconn=ConfigurationManager.AppSettings["connStr"];

SqlConnectionconn=newSqlConnection(strconn);

conn.Open();

DataSetds=newDataSet();

SqlDataAdapterda=newSqlDataAdapter("select*fromuserswhereuserid='"+txtid.Text+"'anduserpwd='"+txtpassword.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]["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;

usingSystem.Data;

usingSystem.Configuration;

usingSystem.Collections;

usingSystem.Web;

usingSystem.Web.Security;

usingSystem.Web.UI;

usingSystem.Web.UI.WebControls;

usingSystem.Web.UI.WebControls.WebParts;

usingSystem.Web.UI.HtmlControls;

usingSystem.Data.SqlClient;

publicpartialclassaddcourse:

System.Web.UI.Page

{

SqlCommandmycmd;

SqlConnectionconn;

protectedvoidPage_Load(objectsender,EventArgse)

{

courseid.Attributes.Add("onblur","checkcourseid()");

stringstrconn=ConfigurationManager.AppSettings["connStr"];

conn=newSqlConnection(strconn);

}

protectedvoidButton1_Click(objectsender,EventArgse)

{

if(courseid.Text.ToString()=="")

{

Label7.Text="课程号不能为空";

}

else

{

stringsqlstr="";

sqlstr="insertintocourse(courseid,coursename,coursetime,fen,type,teacher)values('"+courseid.Text+"','"+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)

{

Response.Write("");

}

finally

{

conn.Close();

sqlstr="";

}

}

}

protectedvoidButton2_Click(objectsender,EventArgse)

{

courseid.Text="";

coursename.Text="";

coursetime.Text="";

fen.Text="";

type.Text="";

}

protectedvoidButton3_Click(objectsender,EventArgse)

{

Response.Redirect("course.aspx");

}

}

三、添加成绩程序代码

usingSystem;

usingSystem.Data;

usingSystem.Configuration;

usingSystem.Collections;

usingSystem.Web;

usingSystem.Web.Security;

usingSystem.Web.UI;

usingSystem.Web.UI.WebControls;

usingSystem.Web.UI.WebControls.WebParts;

usingSystem.Web.UI.HtmlControls;

usingSystem.Data.SqlClient;

publicpartialclassaddscore:

System.Web.UI.Page

{

SqlCommandmycmd;

SqlConnectionconn;

protectedvoidPage_Load(objectsender,EventArgse)

{

stringstrconn=ConfigurationManager.AppSettings["connStr"];

conn=newSqlConnection(strconn);

}

protectedvoidButton1_Click(objectsender,EventArgse)

{

if(userid.SelectedValue.ToString()=="")

{

Label11.Text="学号不能为空";

}

else

{

stringsqlstr="";

sqlstr="insertintoscore(userid,username,courseid,coursename,score,[year])values('"+userid.SelectedValue+"','"+username.Text+"','"+txtcourseid.SelectedValue+"','"+coursename.Text+"','"+score.Text+"','"+txtyear.SelectedValue+"')";

conn.Open();

mycmd=newSqlCommand(sqlstr,conn);

mycmd.Dispose();

try

{

mycmd.ExecuteNonQuery();

Response.Write("");

}

catch(SqlException)

{

Response.Write("");

}

finally

{

conn.Close();

sqlstr="";

}

}

}

protectedvoidButton2_Click(objectsender,EventArgse)

{

username.Text="";

coursename.Text="";

score.Text="";

txtyear.Text="";

}

protectedvoidButton3_Click(objectsender,EventArgse)

{

Response.Redirect("score.aspx");

}

protectedvoiduserid_SelectedIndexChanged(objectsender,EventArgse)

{

stringsqlstr="";

sqlstr="selectusernamefromstudentswhereuserid='"+userid.SelectedValue+"'";

conn.Open();

mycmd=newSqlCommand(sqlstr,conn);

mycmd.Dispose();

SqlDataReaderda;

da=mycmd.ExecuteReader();

while(da.Read())

{

username.Text=da["username"].ToString();

}

}

protectedvoidtxtcourseid_SelectedIndexChanged(objectsender,EventArgse)

{

stringsqlstr="";

sqlstr="selectcoursenamefromcoursewherecourseid='"+txtcourseid.SelectedValue+"'";

conn.Open();

mycmd=newSqlCommand(sqlstr,conn);

mycmd.Dispose();

SqlDataReaderda;

da=mycmd.ExecuteReader();

while(da.Read())

{

coursename.Text=da["coursename"].ToString();

}

}

}

四、添加学生程序代码

usingSystem;

usingSystem.IO;

usingSystem.Text;

usingSystem.Data;

usingSystem.Configuration;

usingSystem.Collections;

usingSystem.Web;

usingSystem.Web.Security;

usingSystem.Web.UI;

usingSystem.Web.UI.WebControls;

usingSystem.Web.UI.WebControls.WebParts;

usingSystem.Web.UI.HtmlControls;

usingSystem.Data.SqlClient;

publicpartialclassaddstudent:

System.Web.UI.Page

{

SqlCommandmycmd;

protectedvoidPage_Load(objectsender,EventArgse)

{

userid.Attributes.Add("onblur","checkuserid()");

stringstrconn=ConfigurationManager.AppSettings["connStr"];

SqlConnectionconn=newSqlConnection(strconn);

}

protectedvoidButton1_Click(objectsender,EventArgse)

{

if(userid.Text.ToString()=="")

return;

stringstrconn=ConfigurationManager.AppSettings["connStr"];

SqlConnectionconn=newSqlConnection(strconn);

stringsqlstr="";

stringsql="";

sqlstr="insertintostudents(userid,username,sex,minzu,birthday,class,comefrom,beizhu,xuey,zhuany,tel,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.SelectedValue+"','"+txttel.Text+"','"+txtidc.Text+"','"+txtzzmm.SelectedValue+"','"+txtzhiw.Text+"','"+txthuoj.Text+"','"+txtweij.Text+"')";

conn.Open();

mycmd=newSqlCommand(sqlstr,conn);

mycmd.Dispose();

stringname=this.FileUpload1.FileName;//获取上传文件的名称

stringtype=name.Substring(name.LastIndexOf("\\")+1);//获取上传文件的后缀

stringipath=Server.MapPath("images/")+DateTime.Now.ToString("yyyyMMddhhmmss")+name;

stringwpath="images\\"+DateTime.Now.ToString("yyyyMMddhhmmss")+name;

stringquery1="insertintoimages(userid,path)values('"+userid.Text+"',@path)";

FileUpload1.SaveAs(ipath);//服务器保存路径

SqlCommandcm=newSqlCommand(query1);

cm.Connection=conn;

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

cm.Parameters["@path"].Value=wpath;

cm.ExecuteNonQuery();

//this.lb_info.Text="上传成功!

";

try

{

mycmd.ExecuteNonQuery();

stringsqlstr1="";

sqlstr1="insertintousers(userid,username)values('"+userid.Text+"','"+txtusername.Text+"')";

SqlCommandmycmd1=newSqlCommand(sqlstr1,conn);

mycmd1.Dispose();

try

{

mycmd1.ExecuteNonQuery();

Response.Write("");

}

catch(SqlException)

{

Response.Write("");

}

finally

{

sqlstr1="";

}

}

catch(SqlException)

{

Response.Write("");

}

finally

{

conn.Close();

sqlstr="";

}

}

protectedvoidButton2_Click(objectsender,EventArgse)

{

userid.Text="";

txtusername.Text="";

txtminzu.Text="";

txtbirthday.Text="";

txtclass.Text="";

txtcomefrom.Text="";

txtbeizhu.Text="";

}

protectedvoidButton3_Click(objectsender,EventArgse)

{

Response.Redirect("student.aspx");

}

}

五、检查课程号唯一性程序代码

usingSystem;

usingSystem.Data;

usingSystem.Configuration;

usingSystem.Collections;

usingSystem.Web;

usingSystem.Web.Security;

usingSystem.Web.UI;

usingSystem.Web.UI.WebControls;

usingSystem.Web.UI.WebControls.WebParts;

usingSystem.Web.UI.HtmlControls;

usingSystem.Data.SqlClient;

publicpartialclasscheckcourseid:

System.Web.UI.Page

{

protectedvoidPage_Load(objectsender,EventArgse)

{

Response.Expires=0;

stringstrconn=ConfigurationManager.AppSettings["connStr"];

SqlConnectionconn=newSqlConnection(strconn);

stringnam=Request.QueryString["name"].ToString();

stringsql="selectcourseidfromcoursewherecourseid='"+nam+"'";

SqlCommandDBHelper;

DBHelper=newSqlCommand(sql,conn);

conn.Open();

SqlDataReaderdr=DBHelper.ExecuteReader();

if(dr.Read())

{

Response.Write("该课程号已经存在,请换一个");

}

else

{

Response.Write("该课程号可以使用");

}

dr.Close();

}

}

六、检查学号唯一性程序代码

usingSystem;

usingSystem.Data;

usingSystem.Configuration;

usingSystem.Collections;

usingSystem.Web;

usingSystem.Web.Security;

usingSystem.Web.UI;

usingSystem.Web.UI.WebControls;

usingSystem.Web.UI.WebControls.WebParts;

usingSystem.Web.UI.HtmlControls;

usingSystem.Data.SqlClient;

publicpartia

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 销售营销

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1