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

📄 studetail.aspx.cs

📁 用vs2005和sql2000完成的学生信息管理系统
💻 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;

namespace stu
{
	/// <summary>
	/// stuDetail 的摘要说明。
	/// </summary>
	public class stuDetail : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label Record_name;
		protected System.Web.UI.WebControls.Label Record_bth;
		protected System.Web.UI.WebControls.Label Record_business;
		protected System.Web.UI.WebControls.Label Record_class_id;
		protected System.Web.UI.WebControls.Label Record_email;
		protected System.Web.UI.WebControls.Label Record_work_ph;
		protected System.Web.UI.WebControls.Label Record_address;
		protected System.Web.UI.WebControls.Label Record_picture;
		protected System.Web.UI.HtmlControls.HtmlInputHidden p_Record_student_id;
		protected System.Web.UI.HtmlControls.HtmlInputButton Record_cancel;
		protected stu Utility;
		public stuDetail()
		{
			this.Init += new System.EventHandler(Page_Init);
		}
		//AdminMenu中的自定义包含控件结束
		public void ValidateNumeric(object source, ServerValidateEventArgs args) 
		{
			try
			{
				Decimal temp=Decimal.Parse(args.Value);
				args.IsValid=true;
			}
			catch
			{
				args.IsValid=false;	}
		}
		//定义登录窗口显示控件过程
		//初始化页面过程,创建一个Utility实例,并调用其相应的各方法
		protected void Page_Load(object sender, EventArgs e)
		{	
			Utility=new stu(this);
			if (!IsPostBack)
			{			
				p_Record_student_id.Value = Utility.GetParam("student_id");
				Page_Show(sender, e);
			}
		}
		//页面关闭过程
		protected void Page_Unload(object sender, EventArgs e)
		{
			if(Utility!=null) Utility.DBClose();
		}
		//窗口中控件定义事件处理过程
		protected void Page_Init(object sender, EventArgs e)
		{
			InitializeComponent();
		}
		private void InitializeComponent()
		{
			this.Record_cancel.ServerClick += new System.EventHandler(this.Record_cancel_ServerClick);
			this.Load += new System.EventHandler(this.Page_Load);
		}
		//定义整体显示页面过程
		protected void Page_Show(object sender, EventArgs e)
		{
			Record_Show();		
		}
		void Record_Show() 
		{	
			bool ActionInsert=true;
			if (p_Record_student_id.Value.Length > 0 ) 
			{
				string sWhere = "";		
				sWhere += "stu_id=" + stu.ToSQL(p_Record_student_id.Value, stu.FIELD_TYPE_Number);
				string sSQL = "select * from stu where " + sWhere;
				SqlDataAdapter dsCommand = new SqlDataAdapter(sSQL, Utility.Connection);
				DataSet ds = new DataSet();
				DataRow row;
				if (dsCommand.Fill(ds, 0, 1, "Record") > 0) 
				{
					row = ds.Tables[0].Rows[0];
					//显示数据				
					
					Record_name.Text =Server.HtmlEncode(stu.GetValue(row, "name").ToString());
					Record_bth.Text =Server.HtmlEncode(stu.GetValue(row, "bth").ToString());
					Record_business.Text =Server.HtmlEncode(stu.GetValue(row, "business").ToString());
					Record_class_id.Text =Server.HtmlEncode(Utility.Dlookup("class", "class_name", "class_id=" + stu.ToSQL(stu.GetValue(row, "class_id"), stu.FIELD_TYPE_Number)).ToString());
					Record_email.Text =stu.GetValue(row, "email");
					Record_work_ph.Text =Server.HtmlEncode(stu.GetValue(row, "ph").ToString());				
					Record_address.Text =Server.HtmlEncode(stu.GetValue(row, "address").ToString());
					Record_picture.Text =stu.GetValue(row, "picture");
					ActionInsert=false;
				}
			}
			if(ActionInsert)
			{
				String pValue;
				pValue = Utility.GetParam("name");
				Record_name.Text = pValue;
				pValue = Utility.GetParam("class_id");
				if (pValue.Length>0){Record_class_id.Text = Utility.Dlookup("class", "class_name", "class_id=" + pValue);}
				pValue = Utility.GetParam("email");Record_email.Text = pValue;
			}
			//Email的超链接
			Record_email.Text="<a href=\"mailto:" + Record_email.Text + "\">" + Record_email.Text + "</a>";
			Record_picture.Text="<img border=0 src=\"images/" + Record_picture.Text + "\">";
		}	
		private void Record_cancel_ServerClick(object sender, System.EventArgs e)
		{
			Response.Redirect("default.aspx");
		}
		//事件结
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -