This is an error, with which i was dumbfounded for weeks. The problem is simple. I have a DataSet and it automatically generates INSERT command. So i can add rows to the DataSet and update it easily. But whenever i change values in existing rows and update it via TableAdapter, I get this exception "Update requires a valid UpdateCommand when passed DataRow collection with modified rows". I found inside the generated code that only INSERT command is generated. Whatever i try, the DataSet designer would not create an UPDATE command nor a DELETE command for this TableAdapter.
Solution 1:
You can select the TableAdapter and write your own query for the update command in the property dialog box.
But this is not a good idea.
Solution 2: (Better one)
The problem lies within your table design. Check it out again and check whether you have created a primary key for the table. Mostly this will be the case, as I forgot to create one. Now after creating the primary key, you can recreate the DataSets to get the corresponding UPDATE and DELETE statements.
But if you do not want a primary key in your table, you may resort to first solution.
![[.NET Error] Update requires a valid UpdateCommand when passed DataRow collection with modified rows](https://www.jeygeethan.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTA2LCJwdXIiOiJibG9iX2lkIn19--e91253d80eb7ffc54f54bf32fb1b812a381fd52f/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJwbmciLCJyZXNpemVfdG9fZml0IjpbODAwLDgwMF19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6e6a0f38c858cc47eaf7fc395a39df3afd3bb47/hPTMJ.png)


![[.NET] ToolTip and "Cannot access a disposed object" exception](https://www.jeygeethan.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTEwLCJwdXIiOiJibG9iX2lkIn19--3b4c315fc9a79786cd0ea4b85fdd37798889788d/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJwbmciLCJyZXNpemVfdG9fZml0IjpbODAwLDgwMF19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6e6a0f38c858cc47eaf7fc395a39df3afd3bb47/9KBMU.png)