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

📄 register.aspx.cs

📁 ASP.net网站开发四“酷”全书:新闻、论坛、电子商城、博客_源码
💻 CS
📖 第 1 页 / 共 2 页
字号:
			oCommand.Parameters.Add(new SqlParameter("@fchrPostCode",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fbitIsAdmin",SqlDbType.Bit,1));
			oCommand.Parameters.Add(new SqlParameter("@fbitIsPower",SqlDbType.Bit,1));
			oCommand.Parameters.Add(new SqlParameter("@flotTopicCount",SqlDbType.Float ,8));
			oCommand.Parameters.Add(new SqlParameter("@flotForumCount",SqlDbType.Float ,8));
			oCommand.Parameters.Add(new SqlParameter("@fchrCardNo",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrIP",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fbitNoUsed",SqlDbType.Bit ,1));
			oCommand.Parameters.Add(new SqlParameter("@fbitKickOff",SqlDbType.Bit ,1));
			oCommand.Parameters.Add(new SqlParameter("@fchrKickOff",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@flotAge",SqlDbType.Float ,8));
			oCommand.Parameters.Add(new SqlParameter("@fbitGender",SqlDbType.Bit ,1));
			
			InnerFunction oFunction = new BusObjectForum.InnerFunction();
			oCommand.Parameters["@fchrOperatorID"].Value = oFunction.getNewID();
			oCommand.Parameters["@fchrOperatorName"].Value= txtLoginName.Text;
			oCommand.Parameters["@fchrMarkID"].Value= "";
			oCommand.Parameters["@flotMark"].Value=0;
			oCommand.Parameters["@fchrLoginName"].Value=txtLoginName.Text ;
			oCommand.Parameters["@fchrPassWord"].Value=this.txtLoginPWD.Text;
			oCommand.Parameters["@fchrIcon"].Value=this.txtICQ.Text;
			oCommand.Parameters["@fdtmDate"].Value=System.DateTime.Now;
			oCommand.Parameters["@fchrRealName"].Value=this.txtRealName.Text;
			oCommand.Parameters["@fchrPhoneNo"].Value=this.txtPhoneNO.Text;
			oCommand.Parameters["@fchrMobile"].Value=this.txtMobile.Text;
			oCommand.Parameters["@fchrMSN"].Value=this.txtMSN.Text;
			oCommand.Parameters["@fchrQQ"].Value=this.txtQQ.Text;
			oCommand.Parameters["@fchrICQ"].Value=this.txtICQ.Text;
			oCommand.Parameters["@fchrDistrict"].Value=this.selDistrict.SelectedValue;
			oCommand.Parameters["@fchrPostCode"].Value=this.txtPostCode.Text;
			oCommand.Parameters["@fbitIsAdmin"].Value=false;
			oCommand.Parameters["@fbitIsPower"].Value=false;
			oCommand.Parameters["@flotTopicCount"].Value=0;
			oCommand.Parameters["@flotForumCount"].Value=0;
			oCommand.Parameters["@fchrCardNo"].Value=this.txtCardNo.Text;
			oCommand.Parameters["@fchrIP"].Value="";
			oCommand.Parameters["@fbitNoUsed"].Value=false;
			oCommand.Parameters["@fbitKickOff"].Value=false;
			oCommand.Parameters["@fchrKickOff"].Value="";
			oCommand.Parameters["@flotAge"].Value=this.txtAge.Text;
			oCommand.Parameters["@fbitGender"].Value=this.selGender.SelectedValue;

			
			oConn.Open();
			try
			{
				oCommand.ExecuteNonQuery();
			}
			catch(Exception exp)
			{
				ErrDesc = exp.Message;
				return false;
			}
			oConn.Close();
			return true;
		}
		//修改用户注册信息
		public bool UpdateRegisterByID(string UID,string conn,out string ErrDesc)
		{	
			ErrDesc = "";
			string sql = "update T_Operator set fchrOperatorName = @fchrOperatorName,fchrLoginName=@fchrLoginName,fchrPassWord=@fchrPassWord,fchrRealName=@fchrRealName," +
					"fbitGender=@fbitGender,flotAge=@flotAge,fchrDistrict=@fchrDistrict,fchrPhoneNo=@fchrPhoneNo,fchrMobile=@fchrMobile,fchrMSN=@fchrMSN,fchrICQ=@fchrICQ," +
					"fchrQQ=@fchrQQ,fchrPostCode=@fchrPostCode,fchrCardNo=@fchrCardNo where fchrOperatorID = @fchrOperatorID and fbitNoUsed=0";
			SqlConnection oConn = new SqlConnection(CONNSTRING);
			
			SqlCommand oCommand = new SqlCommand(sql,oConn);
			oCommand.Parameters.Add(new SqlParameter("@fchrOperatorID",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrOperatorName",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrLoginName",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrPassWord",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fdtmDate",SqlDbType.DateTime ,8));
			oCommand.Parameters.Add(new SqlParameter("@fchrRealName",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrPhoneNo",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrMobile",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrMSN",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrQQ",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrICQ",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrDistrict",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrPostCode",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@fchrCardNo",SqlDbType.VarChar,50));
			oCommand.Parameters.Add(new SqlParameter("@flotAge",SqlDbType.Float ,8));
			oCommand.Parameters.Add(new SqlParameter("@fbitGender",SqlDbType.Bit ,1));
			
			InnerFunction oFunction = new BusObjectForum.InnerFunction();
			oCommand.Parameters["@fchrOperatorID"].Value = UID;
			oCommand.Parameters["@fchrOperatorName"].Value= txtLoginName.Text;
			oCommand.Parameters["@fchrLoginName"].Value=txtLoginName.Text ;
			oCommand.Parameters["@fchrPassWord"].Value=this.txtLoginPWD.Text;
			oCommand.Parameters["@fdtmDate"].Value=System.DateTime.Now;
			oCommand.Parameters["@fchrRealName"].Value=this.txtRealName.Text;
			oCommand.Parameters["@fchrPhoneNo"].Value=this.txtPhoneNO.Text;
			oCommand.Parameters["@fchrMobile"].Value=this.txtMobile.Text;
			oCommand.Parameters["@fchrMSN"].Value=this.txtMSN.Text;
			oCommand.Parameters["@fchrQQ"].Value=this.txtQQ.Text;
			oCommand.Parameters["@fchrICQ"].Value=this.txtICQ.Text;
			oCommand.Parameters["@fchrDistrict"].Value=this.selDistrict.SelectedValue;
			oCommand.Parameters["@fchrPostCode"].Value=this.txtPostCode.Text;
			oCommand.Parameters["@fchrCardNo"].Value=this.txtCardNo.Text;
			oCommand.Parameters["@flotAge"].Value=this.txtAge.Text;
			oCommand.Parameters["@fbitGender"].Value=this.selGender.SelectedValue;

			
			oConn.Open();
			try
			{
				oCommand.ExecuteNonQuery();
			}
			catch(Exception exp)
			{
				ErrDesc = exp.Message;
				return false;
			}
			oConn.Close();
			return true;
		}
		public void btnOK_onclick(object sender, System.EventArgs e)
		{
			string ErrDesc = "";
			string conn = "";
			
			connect_strings oConn = new connect_strings();
			conn = oConn.OLEDBConnectionString;

			if(!CheckOnlyUser(conn,out ErrDesc))
			{
				ErrDesc="已存在用户名为"+ this.txtLoginName.Text +"的用户!";
				Response.Write ("发生错误:"+ErrDesc);
				Response.Write ("<A href='/SampleForum/InitList.aspx'>返回</A>");
			}
			else
			{
				if(RegisterUser(conn,out ErrDesc))
				{
					Response.Write ("注册成功!");
					Response.Write ("<A href='/SampleForum/InitList.aspx'>返回</A>");
				}
				else
				{
					Response.Write ("发生错误:"+ErrDesc);
					Response.Write ("<A href='/SampleForum/InitList.aspx'>返回</A>");
				}
			}
		}
		public void btnUpdate_onclick(object sender, System.EventArgs e)
		{
			string ErrDesc = "";
			string strUID = "";
			connect_strings oConn = new connect_strings();
			string conn = oConn.OLEDBConnectionString;
			try
			{
				strUID = Session["UserID"].ToString();
			}
			catch(NullReferenceException exp)
			{
				strUID = "";
			}

			if(UpdateRegisterByID( strUID, conn,out  ErrDesc))
			{
				Response.Write ("修改注册信息成功!");
				Response.Write ("<A href='/SampleForum/InitList.aspx'>返回</A>");
			}
			else
			{
				Response.Write ("发生错误:"+ErrDesc);
				Response.Write ("<A href='/SampleForum/InitList.aspx'>返回</A>");
			}
		}
		#region Web 窗体设计器生成的代码
		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 + -