01.
Try
02.
For
Each
item
As
ListViewItem
In
lsvproduct.Items
03.
Dim
Conn
As
New
SqlConnection(strCon)
04.
Dim
com
As
New
SqlCommand
05.
Conn.Open()
06.
Dim
a
As
Integer
= Convert.ToInt32(item.SubItems(2).Text)
07.
Dim
sql
As
String
=
" UPDATE STOCK SET QUANTITY=[QUANTITY]- '"
& a &
"' WHERE PRODUCT_ID='"
& item.Text &
"' "
08.
With
com
09.
.Connection = Conn
10.
.CommandType = CommandType.Text
11.
.CommandText = sql
12.
End
With
13.
com.ExecuteNonQuery()
14.
Next
15.
Catch
ex
As
Exception
16.
MessageBox.Show(
"ERROR."
)
17.
End
Try