Private Sub UpdateStock() 'Update(จำนวนหนังสือในสต็อก)
Dim i As Integer = 0
Dim allid As Integer = 0
Dim allbook As Integer = 0
Dim allbooksale As Integer = 0
Dim booksale As Integer = 0
For i = 0 To lv_sale.Items.Count - 1
allbooksale = CInt(lv_sale.Items(i).SubItems(3).Text)
allbook = CInt(lv_sale.Items(i).SubItems(4).Text)
allid = CInt(lv_sale.Items(i).SubItems(1).Text)
Dim sqlb As String
sqlb = "SELECT รหัสหนังสือ,จำนวนที่ขายไป FROM tb_book"
sqlb &= " WHERE (รหัสหนังสือ = '" & allid & "')"