📄 stuserdep.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Configuration;
namespace STcontract.User
{
/// <summary>
/// Stat 的摘要说明。
/// </summary>
public class Stat : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label STDepID;
protected System.Web.UI.WebControls.Label STDepName;
protected System.Web.UI.WebControls.Label STDepMaster;
protected System.Web.UI.WebControls.TextBox STDepInfo;
protected System.Web.UI.HtmlControls.HtmlForm Form1;
SqlConnection STconn;
private void Page_Load(object sender, System.EventArgs e)
{
if(Session["STNickName"] != null)
{
//获得数据库连接字符串
string STconnection = ConfigurationSettings.AppSettings["strconnection"];
//创建数据库连接
STconn = new SqlConnection(STconnection);
if(!IsPostBack)
{
//自定义ST_DgBind()方法,加载自己连锁店的信息
BindGrid();
}
}
else
{
Response.Redirect("../Index.aspx");
}
}
public void BindGrid()
{
STconn.Open();
string STstrsql="select STDep.* from STDep,STUser where STDep.STDepID = STUser.STDepID";
SqlCommand STcmd = new SqlCommand(STstrsql,STconn);
SqlDataReader STsdr = STcmd.ExecuteReader();
while(STsdr.Read())
{
Session["STDepID"] = STsdr["STDepID"];
STDepID.Text = Session["STDepID"].ToString();
Session["STDepName"] = STsdr["STDepName"];
STDepName.Text = Session["STDepName"].ToString();
Session["STDepMaster"] = STsdr["STDepMaster"];
STDepMaster.Text = Session["STDepMaster"].ToString();
Session["STDepInfo"] = STsdr["STDepInfo"];
STDepInfo.Text = Session["STDepInfo"].ToString();
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -