内容发布更新时间 : 2024/12/26 4:33:11星期一 下面是文章的全部内容请认真阅读。
课程设计说明书 NO. 11
public partial class loginfirst : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) { }
protected void btnlogin_Click(object sender, EventArgs e) {
Response.Redirect(\进入学生注册页面 }
protected void btnlogin2_Click(object sender, EventArgs e) {
Response.Redirect(\进入教师注册页面 }
protected void btn2_Click(object sender, EventArgs e)//进入教师页 {
string name = username.Text.Trim(); string psw = password.Text.Trim();
SqlConnection conn = new SqlConnection(\Security=SSPI;database=学生成绩管理;\
SqlCommand cmd = new SqlCommand(\+ \
DataSet ds = new DataSet(); conn.Open();
SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) {
Session[\ Session[\ Response.Redirect(\ } else
l1.Text = \登陆失败!\ }
protected void btn1_Click(object sender, EventArgs e)//进入学生页 {
string name = username.Text.Trim(); string psw = password.Text.Trim();
SqlConnection conn = new SqlConnection(\Security=SSPI;database=学生成绩管理;\
SqlCommand cmd = new SqlCommand(\\
沈 阳 大 学
课程设计说明书 NO. 12
DataSet ds = new DataSet(); conn.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { Session[\ Session[\ Response.Redirect(\ } else l1.Text = \登陆失败!\ } } (3)学生修改页面,如图8所示。 图8 学生修改信息页面 沈 阳 大 学
课程设计说明书 NO. 13
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 ogin : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) { }
protected void butsubmit_Click(object sender, EventArgs e) {
if (Page.IsValid) {
string name = username.Text.Trim(); string psw = password.Text.Trim(); string xuehao = xh.Text.Trim(); string xingming = xm.Text.Trim(); string xingbie = xb.Text.Trim(); string banji = Bj.Text.Trim(); string zhuanye = Zy.Text.Trim(); string sfzh = Sfzh.Text.Trim(); string jia = jtdz.Text.Trim(); string cssj = Rq.Text.Trim();
Session[\ string sql = \ student set
username=@username,password=@password,xm=@xm,xb=@xb,Bj=@Bj,Zy=@Zy,Sfzh=@Sfzh,jtdz=@jtdz,Rq=@Rq where xh=@xh\
SqlParameter[] parameters = { new SqlParameter(\ new SqlParameter(\ new SqlParameter(\ new SqlParameter(\ new SqlParameter(\ new SqlParameter(\ new SqlParameter(\ new SqlParameter(\ new SqlParameter(\
沈 阳 大 学
课程设计说明书 NO. 14
new SqlParameter(\ };
using (SqlConnection conn = new SqlConnection(\Security=SSPI;database=学生成绩管理;\
{
conn.Open();
using (SqlCommand cmd = conn.CreateCommand()) {
cmd.CommandText = sql;
cmd.Parameters.AddRange(parameters); cmd.ExecuteNonQuery(); } }
Response.Write(@\修改成功!');\ } }
protected void btnback_Click(object sender, EventArgs e) {
Response.Redirect(\返回学生界面 } }
(4)老师信息修改页面,如图9所示。
图9老师信息修改
using System;
using System.Collections.Generic; using System.Linq; using System.Web;
沈 阳 大 学
课程设计说明书 NO. 15
using System.Web.UI;
using System.Web.UI.WebControls; using System.Data.SqlClient;
public partial class Tealogin : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) { }
protected void btnSubmit_Click(object sender, EventArgs e) {
// string uid = id.Text.Trim();
string yong = teacheruid.Text.Trim(); string pwd = teacherpwd.Text.Trim(); string ke = kmm.Text.Trim();
Session[\
string sql = \teacheruid=@teacheruid \
SqlParameter[] parameters = { new SqlParameter(\
new SqlParameter(\ //new SqlParameter(\ new SqlParameter(\ using (SqlConnection conn = new SqlConnection(\Security=SSPI;database=学生成绩管理;\
{
conn.Open();
//Session[\
using (SqlCommand cmd = conn.CreateCommand())//tsql {
cmd.CommandText = sql;
cmd.Parameters.AddRange(parameters); cmd.ExecuteNonQuery(); } }
Response.Write(@\修改成功!');\ }
protected void Button1_Click(object sender, EventArgs e) {
Response.Redirect(\} }
沈 阳 大 学