即使我的代码正确,我也无法更新。
我试图将数据类型从String
更改为Integer
,但仍然没有任何反应。
Private Sub UpdateQuanLoop()
For x As Integer = 0 To cartidentifier - 1
UpdateQuantity(ID(x), Quantity(x))
Next
End Sub
Private Sub UpdateQuantity(S_ID As String, S_Quan As String)
Dim finder As Integer
access.AddParam("@proID", S_ID)
access.ExecQuery("SELECT product_quantity FROM product WHERE product_ID = @proID;")
Dim Z As DataRow = access.DBDT.Rows(0)
finder = Z("product_quantity").ToString - S_Quan
access.AddParam("@ID", S_ID)
access.AddParam("@quan", finder)
access.ExecQuery("UPDATE product SET product_quantity = @quan WHERE product_ID = @ID;")
If NoErrors(True) = False OrElse access.RecordCount < 1 Then Exit Sub
End Sub
我没有任何错误,但数据库未更新。