K
kvenkatu
Hello,
I am trying to delete a row from a datagrid using BindingNavigator
delete iterm.
I added the following code in BindingNavigatorDeleteItem_Click().
This code only deletes the record from the datagrid, it does not delete
from the database table.
Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BindingNavigatorDeleteItem.Click
If MessageBox.Show("Are you sure?", "",
MessageBoxButtons.YesNo) =
Windows.Forms.DialogResult.Yes Then
ContactBindingSource.RemoveCurrent()
End If
End Sub
To save to the database table, I need to click on the save button
after deleting a row.
When I click on the save button I am getting "Update requires a valid
DeleteCommand when passed DataRow collection with deleted rows" error
message. I have the following in Saveitem_click:
Me.Validate()
Me.ContactBindingSource.EndEdit()
Me.ContactBindingSourceTableAdapter.Update(Me.DataSet1.Contact)
I would appreciate the help with this problem.
I am trying to delete a row from a datagrid using BindingNavigator
delete iterm.
I added the following code in BindingNavigatorDeleteItem_Click().
This code only deletes the record from the datagrid, it does not delete
from the database table.
Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BindingNavigatorDeleteItem.Click
If MessageBox.Show("Are you sure?", "",
MessageBoxButtons.YesNo) =
Windows.Forms.DialogResult.Yes Then
ContactBindingSource.RemoveCurrent()
End If
End Sub
To save to the database table, I need to click on the save button
after deleting a row.
When I click on the save button I am getting "Update requires a valid
DeleteCommand when passed DataRow collection with deleted rows" error
message. I have the following in Saveitem_click:
Me.Validate()
Me.ContactBindingSource.EndEdit()
Me.ContactBindingSourceTableAdapter.Update(Me.DataSet1.Contact)
I would appreciate the help with this problem.