注册 登录
编程论坛 新人交流区

[求助]着程序怎么就过不去

xjtt 发布于 2007-11-05 17:51, 370 次点击

这是按的代码
可可就是调试不成~~~~~~~~~~
红色的是报错的地方
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();
}

}
}

9 回复
#2
gookee2007-11-05 19:20

数据库保留字段名作祟

#3
akuboy19822007-11-05 20:06

这位同学,你的命名空间是手写的吗?Using System.Data.SqlClient;注意!

#4
akuboy19822007-11-05 20:07
注意代码输入的正确性 try也写错了
#5
xjtt2007-11-06 12:27

恩!这是手写的
try也该了又出现

#6
xjtt2007-11-06 12:31
cs0234:命名空间"System"中不存在类型或命名空间名称"Data"
#7
jacky_gao2007-11-06 13:21
#8
akuboy19822007-11-06 13:29
LZ 问题应该都解决了吧?!加油!~努力!~ 奋斗!~
#9
semenyin2007-11-06 13:33
不懂,呵呵
#10
shengzhiq2007-11-07 23:23
1