教务管理系统课程设计报告(2)

2019-03-15 18:39

(4)课程表

(5)班级表

6

(6)专业表

(7)成绩表

(8)学院表

7

四、详细设计 (1)代码:

(1)登录代码:

Using System.Data.Sqlclient; using System.Configuration; string con = System.Configuration.ConfigurationManager.ConnectionStrings[\ConnectionString.ToString();

SqlConnection sqlcon = new SqlConnection(con);//创建与数据库的连接

sqlcon.Open(); string play;

play = RadioButtonList1.SelectedValue.ToString();

string sqlstr = \* from [usertable] where userid='\+ TextBox1.Text + \构造SQL查询语句

SqlCommand cmd = new SqlCommand(sqlstr, sqlcon); SqlDataReader dr = cmd.ExecuteReader();//执行SQL语句

if (dr.Read()) {

if (RadioButtonList1.SelectedValue.ToString() == \ {

Response.Redirect(\\

}

if (RadioButtonList1.SelectedValue.ToString() == \ {

Response.Redirect(\+

8

TextBox1.Text + \

}

if (RadioButtonList1.SelectedValue.ToString() == \ {

Response.Redirect(\+ TextBox1.Text + \

}

}//判断用户角色 else {

Response.Write(\alert('登录失败!');location.href='Default.aspx';\

}

(2)学生查询代码: string con = System.Configuration.ConfigurationManager.ConnectionStrings[\ConnectionString.ToString();

SqlConnection sqlcon = new SqlConnection(con); sqlcon.Open();

DataSet ds = new DataSet(); string sqlcmd1 = \stuid,stuname,departname,classname,zhuanyename,address,phone from [StuTable] where zhuanyename='\+ DropDownList1.SelectedItem.Text.ToString() + \and classname='\

string sqlcmd2 = \stuid,stuname,departname,classname,zhuanyename,address,phone from [StuTable] where stuname='\构造查询学生SQL语句

if (TextBox1.Text == \ {

SqlCommand cmd = new SqlCommand(sqlcmd1, sqlcon); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(ds, \

GridView1.DataSource = ds.Tables[0].DefaultView; GridView1.DataBind(); } else {

SqlCommand cmd = new SqlCommand(sqlcmd2, sqlcon); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(ds, \

9

GridView1.DataSource = ds.Tables[0].DefaultView; GridView1.DataBind();

}//判断查询方法并邦定到GridView1控件

(3)学生成绩查询代码: string con = System.Configuration.ConfigurationManager.ConnectionStrings[\ConnectionString.ToString();

SqlConnection sqlcon = new SqlConnection(con); sqlcon.Open();

DataSet ds = new DataSet(); string sqlcmd = \id,stuid,courcename,score,xuefen,xuenian,restudy from [ScoreTable] where xuenian='\+ DropDownList1.SelectedItem.Text.ToString() + \stuid='\+ Request.QueryString[\+\通过Request.QueryString[\获取学生学号

SqlCommand cmd = new SqlCommand(sqlcmd, sqlcon); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(ds, \

GridView1.DataSource = ds.Tables[0].DefaultView; GridView1.DataBind();

(4)老师成绩录入代码: string con = System.Configuration.ConfigurationManager.ConnectionStrings[\ConnectionString.ToString();

SqlConnection sqlcon = new SqlConnection(con); sqlcon.Open();

DataSet ds = new DataSet();

for (int i = 0; i < GridView1.Rows.Count; i++) {

DropDownList coure = (DropDownList)GridView1.Rows[i].FindControl(\

DropDownList xuefen = (DropDownList)GridView1.Rows[i].FindControl(\

DropDownList xuenian = (DropDownList)GridView1.Rows[i].FindControl(\

DropDownList restudy = (DropDownList)GridView1.Rows[i].FindControl(\

10


教务管理系统课程设计报告(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:十三五规划小学5年计划2篇

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: