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

📄 zhuce.aspx.cs

📁 这是一个基于WEB的电场耗水量管理与分析系统
💻 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 nicholasbjj
{
	/// <summary>
	/// Summary description for zhuce.
	/// </summary>
	public class zhuce : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.TextBox TextBox1;
		protected System.Web.UI.WebControls.TextBox TextBox2;
		protected System.Web.UI.WebControls.TextBox TextBox3;
		protected System.Web.UI.WebControls.TextBox TextBox4;
		protected System.Web.UI.WebControls.TextBox TextBox5;
		protected System.Web.UI.WebControls.TextBox TextBox6;
		protected System.Web.UI.WebControls.TextBox TextBox7;
		protected System.Web.UI.WebControls.DropDownList DropDownList1;
		protected System.Web.UI.WebControls.Button Button2;
		protected System.Web.UI.WebControls.HyperLink HyperLink8;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
		protected System.Web.UI.WebControls.CompareValidator CompareValidator1;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
		protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1;
		protected System.Web.UI.WebControls.RadioButtonList RadioButtonList1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Button2.Click += new System.EventHandler(this.Button2_Click);
			this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void Button2_Click(object sender, System.EventArgs e)
		{
			string ins="insert into [user] (username,password,comname,admin,phone,email,qq,address) values (";
			ins+="'"+TextBox1.Text+"',";
			ins+="'"+TextBox2.Text+"',";
			ins+="'"+DropDownList1.SelectedValue+"',";
			ins+="'"+RadioButtonList1.SelectedValue+"',";
			ins+="'"+TextBox4.Text+"',";
			ins+="'"+TextBox5.Text+"',";
			ins+="'"+TextBox6.Text+"',";
			ins+="'"+TextBox7.Text+"')";
			try
			{
				string strConn="Server=(local);User ID=sa;Database=bjj;PassWord=temo456";
				SqlConnection conn=new SqlConnection(strConn);
				SqlCommand cmd=new SqlCommand();
				cmd.Connection=conn;
				cmd.CommandText=ins;
				conn.Open();
				cmd.ExecuteNonQuery();
				conn.Close();			
				Response.Redirect("denglu.aspx");
				//Response.Write("<script>alert('注册成功');window.location='denglu.aspx';<script>");
			}
			catch
			{
				
			}
		}

		private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}
	}
}

⌨️ 快捷键说明

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