这是按的代码
可可就是调试不成~~~~~~~~~~
红色的是报错的地方
using System;
using System.Data;
using System.Configuration;
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.Dada.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
sqlConnection mycon = new SqlConnection("server=(192.168.0.7);DataBase=hsdweb2007;ID=sa;PWD=sa");
mycon.Open();
sqlCommand mycom = new Sqlcommand("select count(*)forn tb_UserData where useername='"+TextBox1.Text+""',mycon);
int count = Convert.ToInt32(mycom.ExecuteScalar());
if(count>0)
{
Response.Write("<script>alert('用户名已存在!');location='javascript:history.go(-1)'</script>");
}
}
if(TextBox2.Text != TextBox3.Text)
{
Response.Write("<script>alert('两次输入密码不一至,从新输入!');location='javascript:history.go(-1)'</script>");
}
else
{
SqlConnection con=new SqlConnection("server=(192.168.0.7);DataBase=hsdweb2007;ID=sa;PWD=sa");
con.Open();
sqlTransaction static=con.BeginTransaction();
sqlCommand com=con.CreateCommand();
com.Transaction=sa;
tey
{
com.CommandText="insert into tb_UserData(username,sex,userped,matter,resule,mail,headportrairId,oicq.name,del)
values('"TextBox1.Text+"','"DropDownlist2.Text+"','"+TextBox3.Text+"','"+TextBox5.Text+"','"+TextBox6.Text+"','"+TextBox7.Text+"','"+DropDownlist1.Text+"','"+DropDownlist8.Text+"','"+DropDownlist9.Text+"','"DropDownlist10.Text+"')";
com.ExecuteNonQuery();
com.CommandTexe="insert into tb_log(ip,datetime,name,dns)values('"+Response.userhostaddress+"','"+DataTime.Now+"','"+TextBox1.Text+"','"+"+Response.userhostName+"')";
com.ExecuteNonQuery();
st.Commit();
Response.Write("<script>alert('注册成功!');location='javascript:history.go(-1)'</script>");
}
catch(exception error)
{
st.Rollback();
}
}
}