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

📄 webform1.aspx.cs

📁 2.不是源码 3.缺少文件 4.所选类别和开发环境不对 5.乱写说明或说明不够认真 6.压缩文件有密码 7.源码重复或已经存在 请不要上传有版权争议的内容和木马病毒代码
💻 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.Configuration;   
namespace   aikeding   
{   
	///   <summary>   
	///   reg   的摘要说明。   
	///   </summary>   
	public   class   reg   :   System.Web.UI.Page   
	{   
		protected   System.Web.UI.WebControls.TextBox   webname;   
		protected   System.Web.UI.WebControls.TextBox   realname;   
		protected   System.Web.UI.WebControls.TextBox   birthday;   
		protected   System.Web.UI.WebControls.DropDownList   sex;   
		protected   System.Web.UI.WebControls.DropDownList   animal;   
		protected   System.Web.UI.WebControls.DropDownList   childbearing;   
		protected   System.Web.UI.WebControls.TextBox   avoirdupois;   
		protected   System.Web.UI.WebControls.DropDownList   blood;   
		protected   System.Web.UI.WebControls.TextBox   username;   
		protected   System.Web.UI.WebControls.TextBox   memberid;   
		protected   System.Web.UI.WebControls.TextBox   password;   
		protected   System.Web.UI.WebControls.TextBox   frealname;   
		protected   System.Web.UI.WebControls.TextBox   linkphone;   
		protected   System.Web.UI.WebControls.TextBox   mobile;   
		protected   System.Web.UI.WebControls.TextBox   email;   
		protected   System.Web.UI.WebControls.TextBox   address;   
		protected   System.Web.UI.WebControls.TextBox   post;   
		protected   System.Web.UI.WebControls.TextBox   memo;   
		protected   System.Web.UI.WebControls.Button   Button2;   
		protected   SqlConnection   conn;   
		protected   DateTime   birthday2;   
		private   void   Page_Load(object   sender,   System.EventArgs   e)   
		{   
			//   在此处放置用户代码以初始化页面   
		}   
    
		#region   Web   窗体设计器生成的代码   
		override   protected   void   OnInit(EventArgs   e)   
		{   
			//   
			//   CODEGEN:   该调用是   ASP.NET   Web   窗体设计器所必需的。   
			//   
			InitializeComponent();   
			base.OnInit(e);   
		}   
    
		///   <summary>   
		///   设计器支持所需的方法   -   不要使用代码编辑器修改   
		///   此方法的内容。   
		///   </summary>   
		private   void   InitializeComponent()   
		{           
			this.Button2.Click   +=   new   System.EventHandler(this.Button2_Click);   
			this.Load   +=   new   System.EventHandler(this.Page_Load);   
    
		}   
		#endregion   
    
		private   void   Button2_Click(object   sender,   System.EventArgs   e)   
		{   
			conn=new   SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);   
			conn.Open();   
    
			string   webname2=Request["webname"].ToString();   
			string   realname2=Request["realname"].ToString();   
			string   sex2=Request["sex"].ToString();   
			string   animal2=Request["animal"].ToString();   
			string   childbearing2=Request["childbearing"].ToString();   
			string   memo2=Request["memo"].ToString();   
			string   avoirdupois2=Request["avoirdupois"].ToString();   
			string   blood2=Request["blood"].ToString();   
			string   username2=Request["username"].ToString();   
			string   password2=Request["password"].ToString();   
			string   frealname2=Request["frealname"].ToString();   
			string   linkphone2=Request["linkphone"].ToString();   
			string   mobile2=Request["mobile"].ToString();   
			string   email2=Request["email"].ToString();   
			string   address2=Request["address"].ToString();   
			string   post2=Request["post"].ToString();   
			try   
			{   
				birthday2=Convert.ToDateTime(Request["birthday"]);   
    
			}   
			catch   
			{   
				Response.Write("<script>alert('请按正规格式填写生日,例如:2004-01-01');history.back();</script>");   
				Response.End();   
			}   
			if(webname2==""   ||   username2=="")   
			{   
    
				Response.Write("<script>alert('宝宝网名或用户名均不能为空');history.back();</script>");   
				Response.End();   
			}   
			string   Sql="select   *   from   member   where   webname='"+webname2+"'";   
			SqlCommand   cmd=new   SqlCommand(Sql,conn);   
			SqlDataReader   obj=cmd.ExecuteReader();   
			if(obj.Read())   
			{   
				Response.Write("<script>alert('该宝宝网名己存在');history.back();</script>");   
				Response.End();   
			}   
			obj.Close();   
    
			string   Sql2="select   *   from   member   where   username='"+username2+"'";   
			SqlCommand   cmd2=new   SqlCommand(Sql2,conn);   
			SqlDataReader   obj2=cmd2.ExecuteReader();   
			if(obj2.Read())   
			{   
				Response.Write("<script>alert('该用户名己存在');history.back();</script>");   
				Response.End();   
			}   
			obj2.Close();   
    
			string   Sql5="insert   into   member(webname,realname,birthday,sex,animal,childbearing,memo,avoirdupois,blood,username,password,frealname,linkphone,mobile,email,address,post)values('"+webname2+"','"+realname2+"','"+birthday2+"','"+sex2+"','"+animal2+"','"+childbearing2+"','"+memo2+"','"+avoirdupois2+"','"+blood2+"','"+username2+"','"+password2+"','"+frealname2+"','"+linkphone2+"','"+mobile2+"','"+email2+"','"+address2+"','"+post2+"')";   
			SqlCommand   cmd5=new   SqlCommand(Sql5,conn);   
			cmd5.ExecuteNonQuery();   
			Response.Write("<script>alert('注册成功,请登陆!');window.close();</script>");   
			Response.End();   
		}   
	}   
}   
  

⌨️ 快捷键说明

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