R
Randy
Hi,
Trying to pass along a table row delete to the datasource, but I'm
crashing. Here is the code:
Private Sub btnDeleteIngr_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnDeleteIngr.Click
Dim vbResponse As Integer
vbResponse = MessageBox.Show("Are you sure that you want to
delete " + tbIngr.Text + "?", "Confirm Delete",
MessageBoxButtons.OKCancel, MessageBoxIcon.Warning)
If vbResponse = 1 Then
Dim dr As DataRow
Dim drv As DataRowView
drv = bsIngredients.Current
dr = drv.Row
dr.Delete()
bsIngredients.MoveNext()
taIngredients.Update(dsMenuPlanner.Ingredients)
dsMenuPlanner.AcceptChanges()
End If
End Sub
It's the "taIngredients.Update(dsMenuPlanner.Ingredients)" line that
crashes. The error is "Update requires a valid DeleteCommand when
passed DataRow collection with deleted rows."
I can't figure out how to resolve this. Can anybody help?
Thanks,
Randy
Trying to pass along a table row delete to the datasource, but I'm
crashing. Here is the code:
Private Sub btnDeleteIngr_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnDeleteIngr.Click
Dim vbResponse As Integer
vbResponse = MessageBox.Show("Are you sure that you want to
delete " + tbIngr.Text + "?", "Confirm Delete",
MessageBoxButtons.OKCancel, MessageBoxIcon.Warning)
If vbResponse = 1 Then
Dim dr As DataRow
Dim drv As DataRowView
drv = bsIngredients.Current
dr = drv.Row
dr.Delete()
bsIngredients.MoveNext()
taIngredients.Update(dsMenuPlanner.Ingredients)
dsMenuPlanner.AcceptChanges()
End If
End Sub
It's the "taIngredients.Update(dsMenuPlanner.Ingredients)" line that
crashes. The error is "Update requires a valid DeleteCommand when
passed DataRow collection with deleted rows."
I can't figure out how to resolve this. Can anybody help?
Thanks,
Randy