A1VBCode Forums

delete does not affect database!


http://a1vbcode.com/vbforums/Topic30673.aspx

By maia_18 - 10/2/2011

Hi to all..

i have ha problem with my delete menustrip item...



when i click yes to the verification msgbox, the row i selected is deleted.

but when i click on another button , the row returns!!!

it does not seem to affect the underlying database..

i've seached google, but so far, i still haven't found an answer...

thanks in advance..



codecodecode:



Private Sub DeleteItemToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteItemToolStripMenuItem.Click

dgvLadies.DataSource = vbNull

dsLadies = New DataSet()



daProducts.Fill(dsLadies, "products")

dgvLadies.DataSource = dsLadies.Tables(0)

dgvLadies.Visible = True



If MsgBox("Do you want to delete this row ?", MessageBoxButtons.YesNo) = DialogResult.Yes Then

dsLadies.Tables("products").Rows.RemoveAt(dgvLadies.CurrentRow.Index)

dgvLadies.Rows.RemoveAt(dgvLadies.CurrentRow.Index)

End If

daProducts.Update(dsLadies, "products")

End Sub