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

📄 update.aspx.cs

📁 网络学生家教招聘系统.使用ASP.NET环境+C#开发。功能完备。代码扩展方便。
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
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.IO;
using System.Xml;

namespace PeopleInfo
{
	/// <summary>
	/// Update 的摘要说明。
	/// </summary>
	public class Update : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label regCount;
		protected System.Web.UI.WebControls.Label enterCount;
		protected System.Web.UI.WebControls.TextBox SouthTeams;
		protected System.Web.UI.WebControls.Button btnUpdate;
		protected System.Web.UI.WebControls.TextBox BenBuTeams;
	
		protected SqlConnection conn;
		protected System.Web.UI.WebControls.Label lblNow;
		protected System.Web.UI.WebControls.Label lblNotArranged;
		protected SqlCommand cmd;

		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			conn=new  SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["ConnString"]);
			cmd=new SqlCommand();
			cmd.Connection=conn;

			Session["IsDataPage"]=false;
			Session["CurrentPage"]="Welcome.aspx";

			conn.Open();

			cmd.CommandText="SELECT COUNT(*) FROM RegisterPerson";
			regCount.Text=cmd.ExecuteScalar().ToString();
			cmd.CommandText="SELECT COUNT(*) FROM RegisterPerson WHERE IfEnter='T'";
			enterCount.Text=cmd.ExecuteScalar().ToString();
			cmd.CommandText="SELECT COUNT(*) FROM EnterPerson";
			lblNow.Text=cmd.ExecuteScalar().ToString();
			lblNotArranged.Text=cmd.ExecuteScalar().ToString();

			conn.Close();
			

		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void btnUpdate_Click(object sender, System.EventArgs e)
		{
			if(this.IsValid)
			{				
				XmlDocument xmlWebConfig=new XmlDocument();
				XmlNode mynode;

				xmlWebConfig.Load(Server.MapPath("Web.config"));
				mynode=xmlWebConfig.ChildNodes.Item(1);
				mynode=mynode.ChildNodes[0];
				mynode=mynode.ChildNodes[1];
				mynode.Attributes[1].Value=SouthTeams.Text.Trim();
				mynode=mynode.NextSibling;
				mynode.Attributes[1].Value=BenBuTeams.Text.Trim();
				xmlWebConfig.Save(Server.MapPath("Web.config"));

				cmd.CommandType=CommandType.StoredProcedure;
				cmd.CommandText="dbo.InfoUpdate";
				conn.Open();
				cmd.ExecuteNonQuery();
				conn.Close();
			}
		}
	}
}








⌨️ 快捷键说明

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