How listview delete data in database

Posted by Bud33 on Stack Overflow See other posts from Stack Overflow or by Bud33
Published on 2013-10-18T03:46:14Z Indexed on 2013/10/18 3:54 UTC
Read the original article Hit count: 155

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

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about visual-studio-2010