学生信息管理系统 系统源代码文档格式.docx

上传人:b****3 文档编号:13646386 上传时间:2022-10-12 格式:DOCX 页数:33 大小:19.51KB
下载 相关 举报
学生信息管理系统 系统源代码文档格式.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.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;

username"

]=ds.Tables[0].Rows[0]["

].ToString();

userpower"

if(Session["

].ToString()=="

0"

Response.Redirect("

admin/index.aspx"

);

elseif(Session["

].ToString()=="

1"

student/index.aspx"

Label3.Text="

对不起,权限验证失败"

conn.Close();

ds.Clear();

}

 

二、添加课程页面代码

publicpartialclassaddcourse:

SqlCommandmycmd;

SqlConnectionconn;

protectedvoidPage_Load(objectsender,EventArgse)

courseid.Attributes.Add("

onblur"

"

checkcourseid()"

conn=newSqlConnection(strconn);

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

Label7.Text="

课程号不能为空"

stringsqlstr="

sqlstr="

insertintocourse(courseid,coursename,coursetime,fen,type,teacher)values('

+courseid.Text+"

'

+coursename.Text+"

+coursetime.Text+"

+fen.Text+"

+type.Text+"

+teacher.Text+"

)"

mycmd=newSqlCommand(sqlstr,conn);

mycmd.Dispose();

try

mycmd.ExecuteNonQuery();

Response.Write("

<

script>

javascript:

alert('

添加成功!

!

/script>

catch(SqlException)

添加失败!

finally

protectedvoidButton2_Click(objectsender,EventArgse)

courseid.Text="

coursename.Text="

coursetime.Text="

fen.Text="

type.Text="

protectedvoidButton3_Click(objectsender,EventArgse)

course.aspx"

三、添加成绩程序代码

publicpartialclassaddscore:

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

Label11.Text="

学号不能为空"

insertintoscore(userid,username,courseid,coursename,score,[year])values('

+userid.SelectedValue+"

+username.Text+"

+txtcourseid.SelectedValue+"

+score.Text+"

+txtyear.SelectedValue+"

username.Text="

score.Text="

txtyear.Text="

score.aspx"

protectedvoiduserid_SelectedIndexChanged(objectsender,EventArgse)

selectusernamefromstudentswhereuserid='

SqlDataReaderda;

da

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

当前位置:首页 > IT计算机 > 电脑基础知识

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

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