1

Hello,

I have an problem with updating a database after I have deleted or edited a database row in VB.NET. When I insert a new row it works well.

When I delete I get the following error message:
Update requires a valid DeleteCommand when passed DataRow collection with deleted rows
And when I edit I get the following message:
Update requires a valid UpdateCommand when passed DataRow collection with modified rows

Does someone know the code I need?

Here is the code I use and that does not work:
For deleting:

[INDENT]Me.KlantBindingSource.RemoveCurrent()
        Me.Validate()
        Me.KlantBindingSource.EndEdit()
        KlantTableAdapter.Update(Me.DataDataSet)[/INDENT]

For editing:

[INDENT]Me.Validate()
        Me.KlantBindingSource.EndEdit()
        KlantTableAdapter.Update(Me.DataDataSet)[/INDENT]

The name of mine bindingsource is KlantBindingSource, the name of mine TableAdapter is KlantTableAdapter and the name of mine DataSet is DataDataSet.

I am using Microsoft Visual Studio 2008

2
Contributors
3
Replies
10
Views
9 Years
Discussion Span
Last Post by RipperJT
1

Try checking the properties of the KlantTableAdapters update & delete commands to see if they are valid.

If the table being affected has no primary key this can also cause this type of problem.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.