希叶桠楪 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 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记