温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:某大学学生管理系统(毕业设计)源码
当前文件:
StudentsInfo/default.aspx.cs,打开代码结构图
StudentsInfo/default.aspx.cs,打开代码结构图1using System; 2
using System.Collections; 3
using System.ComponentModel; 4
using System.Data; 5
using System.Data.SqlClient; 6
using System.Drawing; 7
using System.Web; 8
using System.Web.SessionState; 9
using System.Web.UI; 10
using System.Web.UI.WebControls; 11
using System.Web.UI.HtmlControls; 12
using System.Configuration; 13
14
namespace STGROUP 15
{ 16
/// <summary> 17
/// ST_default 的摘要说明。 18
/// </summary> 19
public class ST_default : System.Web.UI.Page 20
{ 21
protected System.Web.UI.WebControls.Button st_btn_enter; 22
protected System.Web.UI.WebControls.TextBox st_tbx_userid; 23
protected System.Web.UI.WebControls.TextBox st_tbx_userpwd; 24
protected System.Web.UI.WebControls.Label st_lbl_note; 25
26
private void Page_Load(object sender, System.EventArgs e) 27
{ 28
// 在此处放置用户代码以初始化页面 29
} 30
31
Web Form Designer generated code 52
53
private void st_btn_enter_Click(object sender, System.EventArgs e) 54
{ 55
string st_connstr= ConfigurationSettings.AppSettings["st_dbconn"]; 56
SqlConnection st_conn=new SqlConnection(st_connstr); 57
st_conn.Open(); 58
string st_sqlstr="select * from ST_users where ST_User_id='"+st_tbx_userid.Text+"'and ST_User_password='"+st_tbx_userpwd.Text+"'"; 59
SqlCommand st_comm=new SqlCommand(st_sqlstr,st_conn); 60
SqlDataReader st_dreader=st_comm.ExecuteReader(); 61
if(st_dreader.Read()) 62
{ Session["User_id"]=st_dreader["ST_User_id"]; 63
Session["user_power"]=st_dreader["ST_User_power"]; 64
if((int)Session["User_power"]==0) 65
{ 66
Response.Redirect("ST_query.aspx"); 67
} 68
else 69
{ 70
Response.Redirect("ST_student.aspx"); 71
} 72
} 73
else 74
{ 75
st_lbl_note.Text="登录失败!"; 76
} 77
st_conn.Close(); 78
} 79
80
81
} 82
} 83





}