.net: Tableadapter and UpdateCommand problem

This is just to remind myself or inform others of the solution to this problem:

“Update requires a valid UpdateCommand when passed DataRow collection with modified rows.”

Now the solution to this is the following:

1. In your datadaset diagram, check the tableadapter UpdateCommand, by clicking on tableadapter and confirm on the properties that the updateCommand is set. And if your table is joined table or a view, then you need to update that sql statement.

2. A primary key or unique column on the table. Converting from an Access database does not usually bring over the PK which is needed to construct the WHERE clause to point to the row to change.
3. The column names can’t contain special characters.
4. The columns can’t “participate” in Foreign Key constraints.

Let me know if you have additional problems with that.

One more thing, I forgot. Make sure you have a primary key already set for that table on the actual table definition before you drag it into your dataset, otherwise it will give you that problem.

Sphere: Related Content

Uncategorized

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

Hi

This post sure gave me a quick reference as to what I wanted. Thanks a ton.

Shreekar

I am glad it did. I’ve been through your foot steps before and I could rarely find anything. So I decided to add the solution over here.

But hey, if you needed extra help or such, let me know.

hey thanks for that tip, it was just what i needed

Leave a comment

(required)

(required)