How listview delete data in database
- by Bud33
I have a problem to delete data in listview, I was able to delete data in listview select record, but data which selected is not deleted in the database, I have a source code
Private _updateinputalltrans As Boolean
Private Sub btndelete_Click(sender As System.Object, e As System.EventArgs) Handles btndelete.Click
With Me.listviewpos.SelectedItem
.Remove()
End With
MessageBox.Show("Are you sure delete this record?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, New EventHandler(AddressOf DeleteData))
End Sub
Private Sub DeleteData(ByVal sender As Object, ByVal e As EventArgs)
Dim conn As New Connection(Connectiondb)
If Me.updateinputalltrans = False Then
If Me.listviewpos.Items.Count > 0 Then
For Each del As ListViewItem In listviewpos.Items
conn.delete_dtpospart(del.Text)
Next
End If
End If
End Sub
delete_dtpospart a declare which connection to the database using a stored procedure