我一直在处理我的Update Sql语句,但在我的代码中找不到语法错误。我的插入语句正在工作,我从另一个表单中选择他们的登录ID进行比较。
conn.Open()
Dim SqlUpdate As String = "UPDATE tblLogin SET UserPassword =@UserPassword , FirstName =@FirstName , Surname =@Surname , DateofBirth =@DateofBirth , Phonenumber =@Phonenumber , Emailaddress = @Emailaddress , Administrator = @Administrator , Height = @Height , Weight = @Weight , WHERE UserID = @UserID "
Dim SqlCommand As New OleDbCommand
With SqlCommand
.CommandText = SqlUpdate
.Parameters.AddWithValue("@UserPassword", passwordsubmitbox.Text)
.Parameters.AddWithValue("@FirstName", forenamebox.Text)
.Parameters.AddWithValue("@Surname", surnamebox.Text)
.Parameters.AddWithValue("@DateofBirth", DOBselection.Value)
.Parameters.AddWithValue("@Phonenumber", phonenumberbox.Text)
.Parameters.AddWithValue("@Emailaddress", emailadressbox.Text)
.Parameters.AddWithValue("@Administrator", "N")
.Parameters.AddWithValue("@Height", CInt(heightbox.Text))
.Parameters.AddWithValue("@Weight", CInt(weightbox.Text))
.Parameters.AddWithValue("@UserID", Formlogin.UsernameBox1.Text)
.Connection = conn
.ExecuteNonQuery()
End With
conn.Close()
答案 0 :(得分:0)
您的查询在,
@Weight
语法错误
Weight = @Weight WHERE UserI ...