⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userdetail.aspx.cs

📁 比较完整的仓库管理系统 大家都看看 希望对你们有帮助吧
💻 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.Configuration ;
using System.Data .SqlClient ;

namespace MMS
{
	/// <summary>
	/// userdetail 的摘要说明。
	/// </summary>
	public class userdetail : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label lbl_uid;
		protected System.Web.UI.WebControls.Label lbl_id;
		protected System.Web.UI.WebControls.Label lbl_uid2;
		protected System.Web.UI.WebControls.Label lbl_usex;
		protected System.Web.UI.WebControls.Label lbl_upower;
		protected System.Web.UI.WebControls.Label lbl_ccountrynm;
		protected System.Web.UI.WebControls.Label lbl_cname;
		protected System.Web.UI.WebControls.Label lbl_uemail;
	
		private void Page_Load(object sender, System.EventArgs e)
		{//从文件Web.config中读取连接字符串
			string strconn= ConfigurationSettings.AppSettings["dsn"];
			//连接本地计算机的MMS数据库
			SqlConnection cn= new SqlConnection (strconn);
			//创建SQL语句
			string mysql="select * from  Users ,City where Users.UCityID=City.CID and Users.UID=@UID";
			SqlCommand cm=new SqlCommand (mysql,cn);
			//添加并设置参数的值
			cm.Parameters .Add ("@UID", SqlDbType.VarChar );
			cm.Parameters ["@UID"].Value =Request.QueryString [0];
			//打开连接
			cn.Open ();
			//执行ExecuteReader
			SqlDataReader dr=cm.ExecuteReader ();
			if(dr.Read ())//有数据读出,即有匹配用户
			{
				//进行Label绑定
				lbl_uid.Text =dr["UID"].ToString ();
				lbl_id.Text =dr["ID"].ToString ();
				lbl_uid2.Text =dr["UID"].ToString ();
				if(dr["USex"].ToString ()=="1")lbl_usex.Text ="男";
				else lbl_usex.Text ="女";
				if(dr["UPower"].ToString ()=="1") lbl_upower.Text ="管理员";
				else lbl_upower.Text ="普通会员";
				lbl_cname.Text =dr["CName"].ToString ();
				lbl_ccountrynm.Text =dr["CCountryNm"].ToString ();
				lbl_uemail.Text =dr["Email"].ToString ();
				cn.Close ();
			}
			else
			{
				Response.Write ("该用户不存在,请返回");
				Response.End ();
			}
		}

		#region Web Form Designer generated code
		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 + -