📄 masterpage2.master.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 MasterPage2 : System.Web.UI.MasterPage
{
SqlConnection conn;
protected void Page_Load(object sender, EventArgs e)
{
string myconn=System .Configuration .ConfigurationManager .AppSettings ["ConnectionString"];
conn = new SqlConnection(myconn );
stuID.Text = Session["userName"].ToString();
string sqlselect = "select stuID,stuName,stuClass from student where student.stuID='" + Session["userName"].ToString() + " '";
SqlCommand comm1 = new SqlCommand(sqlselect, conn);
conn.Open();
SqlDataReader dr = comm1.ExecuteReader();
if (dr.Read())
{
stuName.Text = dr["stuName"].ToString();
stuClass.Text = dr["stuClass"].ToString();
}
conn.Close();
}
protected void Button2_Click1(object sender, EventArgs e)
{
Response.Redirect("Login.aspx");
}
protected void chakan_Click(object sender, EventArgs e)
{
Response.Redirect("elect.aspx");
}
protected void modifyPwd_Click(object sender, EventArgs e)
{
Response.Redirect("ModifyPwd.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -