vs2003+sql2000+iis6.0
运行时正常,参数和数据库结构一一对应,但是受影响行数为0.....数据库里没东西T_Tb/s结构代码如下:
web页代码private void ProcessNewAccount()
{
if(Page.IsValid ==true)
{
if(BLL.Customer.addAccount(txtUserName.Text, txtPassword.Text,txtEmail.Text, txtFirstName.Text,
txtLastName.Text, txtAddress1.Text, txtAddress2.Text,
txtCity.Text,listState.SelectedItem.Text,txtPostalCode.Text,
listCountry.SelectedItem.Text, txtTelephoneNumber.Text)==0)
{
Response.Redirect("ValidateAccount.aspx?action=errorAccount");
}
else
{
HttpCookie customerCookie=new HttpCookie("CustomerId",txtUserName.Text);
Response .Cookies .Add(customerCookie);
Response.Redirect("ValidateAccount.aspx?action=createAccount");
}
}
}bll层代码public static int addAccount(string userid, string password, string email, string firstName, string lastName, string address1, string address2,string city, string state, string zip, string country, string phone)
{
return DAL.Customer.addAccount(userid,password,email,firstName, lastName,address1,address2,city,state,zip,country, phone);
}
dal层代码public static int addAccount(string userid, string password, string email, string firstName,string lastName, string address1, string address2,string city, string state, string zip, string country,
string phone)
{
SqlConnection connSql=new SqlConnection(SQLHelper.CONN_STRING);
SqlCommand commSql=new SqlCommand("insert into Account(Userid,Password,[E-mail],Firstname,Lastname,Add1,Add2,City,State,Zip,Country,Phone) value(@userid,@password,@email,@firstName,@lastName,@address1,@address2,@city,@state,@zip,@country,@phone)",connSql);
commSql.Parameters .Add("@userid",userid);
commSql.Parameters .Add("@password",password);
commSql.Parameters .Add("@email",email);
commSql.Parameters .Add("@firstName",firstName);
commSql.Parameters .Add("@lastName",lastName);
commSql.Parameters .Add("@address1",address1);
commSql.Parameters .Add("@address2",address2);
commSql.Parameters .Add("@city",city);
commSql.Parameters .Add("@state",state);
commSql.Parameters .Add("@zip",zip);
commSql.Parameters .Add("@country",country);
commSql.Parameters .Add("@phone",phone); int result=0;
try
{
connSql.Open();
result=commSql.ExecuteNonQuery();
}
catch(Exception ex)
{
result=0;
}
finally
{
connSql.Close();
}
return result;
}
运行时正常,参数和数据库结构一一对应,但是受影响行数为0.....数据库里没东西T_Tb/s结构代码如下:
web页代码private void ProcessNewAccount()
{
if(Page.IsValid ==true)
{
if(BLL.Customer.addAccount(txtUserName.Text, txtPassword.Text,txtEmail.Text, txtFirstName.Text,
txtLastName.Text, txtAddress1.Text, txtAddress2.Text,
txtCity.Text,listState.SelectedItem.Text,txtPostalCode.Text,
listCountry.SelectedItem.Text, txtTelephoneNumber.Text)==0)
{
Response.Redirect("ValidateAccount.aspx?action=errorAccount");
}
else
{
HttpCookie customerCookie=new HttpCookie("CustomerId",txtUserName.Text);
Response .Cookies .Add(customerCookie);
Response.Redirect("ValidateAccount.aspx?action=createAccount");
}
}
}bll层代码public static int addAccount(string userid, string password, string email, string firstName, string lastName, string address1, string address2,string city, string state, string zip, string country, string phone)
{
return DAL.Customer.addAccount(userid,password,email,firstName, lastName,address1,address2,city,state,zip,country, phone);
}
dal层代码public static int addAccount(string userid, string password, string email, string firstName,string lastName, string address1, string address2,string city, string state, string zip, string country,
string phone)
{
SqlConnection connSql=new SqlConnection(SQLHelper.CONN_STRING);
SqlCommand commSql=new SqlCommand("insert into Account(Userid,Password,[E-mail],Firstname,Lastname,Add1,Add2,City,State,Zip,Country,Phone) value(@userid,@password,@email,@firstName,@lastName,@address1,@address2,@city,@state,@zip,@country,@phone)",connSql);
commSql.Parameters .Add("@userid",userid);
commSql.Parameters .Add("@password",password);
commSql.Parameters .Add("@email",email);
commSql.Parameters .Add("@firstName",firstName);
commSql.Parameters .Add("@lastName",lastName);
commSql.Parameters .Add("@address1",address1);
commSql.Parameters .Add("@address2",address2);
commSql.Parameters .Add("@city",city);
commSql.Parameters .Add("@state",state);
commSql.Parameters .Add("@zip",zip);
commSql.Parameters .Add("@country",country);
commSql.Parameters .Add("@phone",phone); int result=0;
try
{
connSql.Open();
result=commSql.ExecuteNonQuery();
}
catch(Exception ex)
{
result=0;
}
finally
{
connSql.Close();
}
return result;
}
解决方案 »
- 操作数据库超时问题求助...
- 大量客户端数据传输给服务端问题
- javascript 缺少对象问题请教
- 当数据还没有载入进来前如何显示一个载入进度
- 我日的疯了,什么破JAVASCRIPT啊,不出错也不成功!!!帮忙
- FreeTextBox中的回车换行问题
- 关于2个站共用某数据库中的某个表,求一解决方案~~~欢迎进来讨论~~
- 两个非常简单却又非常实用的问题,UP有分!!!!!!
- 谁能告诉我一个点一下就能把左边部分隐掉的分割条控件叫什么?去哪下载?
- 在C#中,如何处理日期相减,并得到天数(long)?
- DropDownList控件,首先选择第一项不执行DropDownList1_SelectedIndexChanged事件。
- 客户端调用服务器端的函数
语句已终止。这个怎么解决????