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=(xjhsdhj);DataBase=Hsdweb2007;ID=sa;PWD=sa");
mycon.Open();
sqlCommand mycom = new Sqlcommand("select count(*)forn tb_UserData where useername='"+TextBox1.Text+"");
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 st=con.BeginTransaction();
sqlCommand com=con.CreateCommand();
com.Transaction=sa;
try
{
com.CommandText="insert into tb_UserData(username,sex,userpwd,matter,resule,mail,headportraitID,oicq.name,del) values("+TextBox1.Text+","+DropDownlist2.Text+","+TextBox3.Text+","+TextBox5.Text+","+TextBox6.Text+","+TextBox7.Text+","+TextBox8.Text+","+TextBox9.Text+","+TextBox10.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();
}
}
}
}
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: CS0234: 命名空间“System”中不存在类型或命名空间名称“Dada”(是缺少程序集引用吗?)
源错误:
行 8: using System.Web.UI.WebControls.WebParts;
行 9: using System.Web.UI.HtmlControls;
行 10: using System.Dada.SqlClient;
行 11: public partial class _Default : System.Web.UI.Page
行 12: {
源文件: d:\My Documents\Visual Studio 2005\WebSites\WebSite4\BbsEnrol.aspx.cs 行: 10