📄 default.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void st_btn_enter_Click(object sender, EventArgs e)
{
string st_connstr= ConfigurationManager.AppSettings["st_dbconn"];
SqlConnection st_conn=new SqlConnection(st_connstr);
st_conn.Open();
string st_sqlstr="select * from ST_users where ST_User_id='"+st_tbx_userid.Text+"'and ST_User_password='"+st_tbx_userpwd.Text+"'";
SqlCommand st_comm=new SqlCommand(st_sqlstr,st_conn);
SqlDataReader st_dreader=st_comm.ExecuteReader();
if(st_dreader.Read())
{ Session["User_id"]=st_dreader["ST_User_id"];
Session["user_power"]=st_dreader["ST_User_power"];
if((int)Session["User_power"]==0)
{
Response.Redirect("ST_course_student.aspx");
}
else
{
Response.Redirect("ST_student.aspx");
}
}
else
{
st_lbl_note.Text="登录失败!";
}
st_conn.Close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -