网站开发注册页面出错
求大神指导程序代码:
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Globalization; using GROUP.Manage; public partial class 注册 : System.Web.UI.Page{ Class1 BaseClass1 = new Class1(); protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { if (CustomValidator1.IsValid == true) { string strsql; strsql = "insert into 用户 (用户名,密码,真实姓名,电话,地址,邮编) values ('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "')"; BaseClass1.execsql(strsql); Response.Write("<script>alert(\"注册成功!\");</script>"); Session["name"] = TextBox1.Text; Response.Redirect("Default.aspx"); } } protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) { string strsql = "select * from 用户 where 用户名 ='" + args.Value.ToString() + "'"; DataSet ds = new DataSet(); ds = BaseClass1.GetDataSet(strsql, "username"); if (ds.Tables["username"].Rows.Count > 0) { args.IsValid = false; } else { args.IsValid = true; } } }