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

时间:2021-12-21 22:49:10
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 个解决方案

#1


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

You need to add space before Update in second string

您需要在第二个字符串中的Update之前添加空格

#1


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

You need to add space before Update in second string

您需要在第二个字符串中的Update之前添加空格