必须声明标量变量“@useridaUPDATE”

时间:2013-04-11 08:17:47

标签: asp.net vb.net

sqlqrystrng = "UPDATE temp_user_details set user_name = @username, user_email = @useremail, user_contact = @usercontact, user_address=@useraddress WHERE user_id = @userida"
sqlqrystrng2 = "UPDATE user_type set user_password = @userpassword where user_id = @useridb"
string_cnct = sqlqrystrng & sqlqrystrng2

conn.open

cmd = New SqlCommand(string_cnct, conn)

cmd.Parameters.Add(cmd.CreateParameter).ParameterName = "@userida"
cmd.Parameters.Add(cmd.CreateParameter).ParameterName = "@useridb"

cmd.Parameters.Item("@userida").Value = struserid
cmd.Parameters.Item("@useridb").Value = struserid

1 个答案:

答案 0 :(得分:1)

sqlqrystrng = "UPDATE temp_user_details set user_name = @username, user_email = 
useremail, user_contact = @usercontact, user_address=@useraddress WHERE user_id = 
userida"
sqlqrystrng2 = " UPDATE user_type set user_password = @userpassword where user_id = @useridb"
string_cnct = sqlqrystrng  & sqlqrystrng2
conn.open
cmd = New SqlCommand(string_cnct, conn)
cmd.Parameters.Add(cmd.CreateParameter).ParameterName = "@userida"
cmd.Parameters.Add(cmd.CreateParameter).ParameterName = "@useridb"
cmd.Parameters.Item("@userida").Value = struserid
cmd.Parameters.Item("@useridb").Value = struserid

您需要在第二个字符串

中的更新之前添加空格