Reputation: 189
This is my code:
Dim I As Integer
cn.BeginTrans()
cn.Execute("UPDATE tb_user_account SET st_time_per_day='" & TempTPD.Text &
"' WHERE st_acc_number='" & ListViewAccounts.SelectedItems(I).Text & "'")
cn.CommitTrans()
Now what is does is update a selected item in a listview, and i'm using a context menu strip what i noticed was, when i highlight two items it only updates 1. what i want to do is, to update items depending how many items i highlighted. How can i achieve this?
Upvotes: 1
Views: 2715
Reputation: 89325
Try to iterate through all SelectedItems
and execute update query for each :
cn.BeginTrans()
For Each selectedItem As ListViewItem In ListViewAccounts.SelectedItems
cn.Execute("UPDATE tb_user_account SET st_time_per_day='" _
& TempTPD.Text & _
"' WHERE st_acc_number='" _
& selectedItem.Text & "'")
Next
cn.CommitTrans()
Upvotes: 3