希叶桠楪 2016-05-05 06:44 采纳率: 0%
浏览 1421

毕设论坛的用户注册成功,但在数据库中看不到是为什么啊,我用的是vs2010和sql2008r2.

using System;using System.Collections;using System.Configuration;using System.Data;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;public partial class Reg : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("index.aspx"); } protected void Button1_Click1(object sender, EventArgs e) { if (this.txtZH.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "info", "alert('帐号不能为空!');"); return; } if (this.txtMM.Text.Trim() != this.txtQRMM.Text.Trim()) { Page.ClientScript.RegisterStartupScript(this.GetType(), "info", "alert('密码不一致!');"); return; } DataTable tmpda = new DataTable(); tmpda = DataControl.GetData("select * from 用户 where 帐号='" + txtZH.Text + "'"); if (tmpda.Rows.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "info", "alert('此用户已经存在,请重新输入!');"); return; } //添加注册的会员信息到数据库中 DataControl.Execute("INSERT INTO 用户 VALUES ('" + txtZH.Text + "','" + txtMM.Text + "','" + txtXM.Text + "','普通','" + txtSFZH.Text + "','" + txtSJH.Text + "')"); Session["JB"] ="用户"; Session["UserID"] = this.txtZH.Text.Trim(); Page.ClientScript.RegisterStartupScript(this.GetType(), "info", "alert('保存成功!');window.location.href='Index.aspx';"); }}

  • 写回答

3条回答 默认 最新

  • Royal_lr 2016-05-05 07:24
    关注

    用代码片,,这个代码可读性太差了

    评论

报告相同问题?

悬赏问题

  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 spring后端vue前端
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题