课程设计说明书 NO. 16
(5)老师录入成绩页面,如图10所示。
图10 老师录入成绩页面果
using System;
using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;
using System.Web.UI.WebControls; using System.Data.SqlClient;
public partial class TeaInput : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) { }
protected void TextBox5_TextChanged(object sender, EventArgs e) { }
protected void Button1_Click(object sender, EventArgs e) {
//string uid = id.Text.Trim(); string xuehao = xh.Text.Trim(); string xingming = xm.Text.Trim(); string banji = Bj.Text.Trim(); string xueqi = xq.Text.Trim();
沈 阳 大 学
课程设计说明书 NO. 17
string ke = kmm.Text.Trim(); string chengji = cj.Text.Trim(); string shijian = rq.Text.Trim();
string sql = \ values(@xh,@xm,@Bj,@xq,@kmm,@cj,@rq)\
SqlParameter[] parameters = {// new SqlParameter(\
new SqlParameter(\ new SqlParameter(\ new SqlParameter(\ new SqlParameter(\ new SqlParameter(\ new SqlParameter(\ new SqlParameter(\ using (SqlConnection conn = new SqlConnection(\Security=SSPI;database=学生成绩管理;\ {
conn.Open();
using (SqlCommand cmd = conn.CreateCommand())//tsql {
cmd.CommandText = sql;
cmd.Parameters.AddRange(parameters); cmd.ExecuteNonQuery(); } } }
protected void Button2_Click1(object sender, System.EventArgs e) {
Response.Redirect(\返回 } }
沈 阳 大 学
课程设计说明书 NO. 18
(6)学生成绩查询,如图11所示。
图11 学生成绩查询
using System;
using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;
using System.Web.UI.WebControls; using System.Data;
using System.Data.SqlClient; using System.Data.OleDb;
public partial class stu : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
lb.Text = (string)Session[\ }
protected void Button3_Click(object sender, EventArgs e) {
Response.Redirect(\ }
protected void Button1_Click(object sender, EventArgs e) {
SqlConnection conn = new SqlConnection(\Security=SSPI;database=学生成绩管理;\
string km = kmm.Text;
// string cheng= chengji.Text; conn.Open();
SqlCommand comm = new SqlCommand(\ \
DataSet ds = new DataSet();
沈 阳 大 学
课程设计说明书 NO. 19
SqlDataReader dr = comm.ExecuteReader(); if (dr.Read()) {
this.chengji.Text = dr.GetString(dr.GetOrdinal(\获得数据 } } }
(7)老师统计成绩查询,如图12所示。
图12 老师统计成绩查询
using System;
using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;
using System.Web.UI.WebControls; using System.Data.Odbc; using System.Data;
using System.Data.SqlClient;
public partial class tea : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) { }
protected void Button1_Click(object sender, EventArgs e) {
Response.Redirect(\成绩页面 }
protected void Button2_Click(object sender, EventArgs e) {
沈 阳 大 学
课程设计说明书 NO. 20
Response.Redirect(\修改页面 }
protected void TextBox1_TextChanged(object sender, EventArgs e) { }
protected void Button3_Click(object sender, EventArgs e) {
SqlConnection conn = new SqlConnection(\Security=SSPI;database=学生成绩管理;\
string KMM = TextBox1.Text; conn.Open();
SqlCommand comm = new SqlCommand(\+ \
DataSet ds = new DataSet();
SqlDataReader dr = comm.ExecuteReader(); if (dr.Read()) {
//获得数据
this.TextBox2.Text = dr.GetString(dr.GetOrdinal(\ } }
protected void Button4_Click(object sender, EventArgs e) {
SqlConnection conn = new SqlConnection(\Security=SSPI;database=学生成绩管理;\
conn.Open();
SqlCommand comm = new SqlCommand(\ Bj,kmm,avg(cj) as avgcj from chengji group by Bj,kmm order by avgcj desc;\
DataSet ds = new DataSet();
SqlDataReader dr = comm.ExecuteReader(); if (dr.Read()) {
//获得数据
this.TextBox4.Text = dr.GetString(dr.GetOrdinal(\ } }
protected void TextBox4_TextChanged(object sender, EventArgs e) { }
protected void TextBox2_TextChanged(object sender, EventArgs e)
沈 阳 大 学