您目前尚未登陆,请选择【登陆】或【注册
首页->留言本类->学习型留言板源码>>reg.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:学习型留言板源码
当前文件:文件类型 StudyLeaveWord/reg.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12using System.Collections.Generic; 13//该源码下载自www.51aspx.com(51aspx.com) 14 15public partial class reg : System.Web.UI.Page 16{ 17 private const string sql = "insert into login values(@UserName,@Password,@Email,@Phone,@Address)"; 18 private const string userName = "@UserName"; 19 private const string passWord = "@Password"; 20 private const string email = "@Email"; 21 private const string phone = "@Phone"; 22 private const string address = "@Address"; 23 protected void Page_Load(object sender, EventArgs e) 24 { 25 26 } 27 private SqlParameter[] getParam() 28 { 29 SqlParameter[] param = SqlHelp.GetCachedParameters(sql); 30 if (param == null) 31 { 32 param = new SqlParameter[] { new SqlParameter(userName,SqlDbType.VarChar,20), 33 new SqlParameter(passWord,SqlDbType.VarChar,20), 34 new SqlParameter(email,SqlDbType.VarChar,50), 35 new SqlParameter(phone,SqlDbType.VarChar,12), 36 new SqlParameter(address,SqlDbType.VarChar,20) 37 }; 38 SqlHelp.CacheParameters(sql, param); 39 } 40 return param; 41 } 42 private bool regMember(IList<string> list) 43 { 44 SqlParameter[] param = getParam(); 45 param[0].Value = list[0].ToString(); 46 param[1].Value = list[1].ToString(); 47 param[2].Value = list[1].ToString(); 48 param[3].Value = list[1].ToString(); 49 param[4].Value = list[1].ToString(); 50 bool flag = Convert.ToBoolean(SqlHelp.getExecuteNonQuery(SqlHelp.con,CommandType.Text,sql,param)); 51 return flag; 52 } 53 protected void btnreg_Click(object sender, EventArgs e) 54 { 55 if (Page.IsValid) 56 { 57 IList<string> list = new List<string>(); 58 list.Add(this.txtUserName.Text.Trim()); 59 list.Add(this.txtPassword.Text.Trim()); 60 list.Add(this.txtEmail.Text.Trim()); 61 list.Add(this.txtPhone.Text.Trim()); 62 list.Add(this.txtAddress.Text.Trim()); 63 if (regMember(list)) 64 { 65 FormsAuthentication.RedirectFromLoginPage(list[0].ToString(), false, null); 66 Response.Redirect("index.aspx"); 67 } 68 } 69 } 70} 71
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:学习型留言板源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号