简体   繁体   中英

Update query mysql to VB.net

I tried this query on mysql and it works perfectly.

UPDATE tblstocklog 
SET quantity = quantity - 5
WHERE(ProductNo = 25370)
AND quantity >= 5
ORDER BY StockNo ASC LIMIT 1

But when I tried it with VB.net it doesn't update nor give a error message.

con3.Open()

query3 = "UPDATE tblstocklog set Quantity = Quantity - '" & txt_qty.Text & _
"' WHERE (ProductNo = '" & txt_pno.Text & _ 
"') AND Quantity >= '" & txt_qty.Text & "' ORDER by StockNo ASC LIMIT 1"

Dim cmd3 As MySqlCommand = New MySqlCommand(query, con3)
Dim i3 As Integer = cmd3.ExecuteNonQuery()
con3.Close()

Sorry guys I was in a hurry doing my program and I missed a clear error.

Dim cmd3 As MySqlCommand = New MySqlCommand(**query**, con3)

query should be query3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM