Question Typed Dataset, Update require a valid UpdatCommand

gm.arain

New member
Joined
Feb 27, 2011
Messages
1
Programming Experience
1-3
I am using VB net 2005 for Desktop Application and SQL Server 2000 as a database server. For data access I am using “Typed Dataset”.

Whenever I want to save data after editing and deletion VB shows the following error.
“Update require a valid UpdatCommand when passed DataRow collection with modification rows.”
This error not occurs when I am saving after addition of new record.
Please guide me where is actual problem.
 

Attachments

If your table does't have a primary key it can't generate Update and Delete commands for you, because these depends on uniquely identifying the row.
 
That error does not occur after adding a new record. It occurs after editing an existing record. If it was an issue with new rows it would be talking about inserting rather than updating. That error occurs because your TableAdapter has no command assigned to its UpdateCommand property, which means that the wizard failed to generate one. That would occur either because your table has no primary key or your query joins multiple tables. I'm guessing that it's the first one. The PK is there to uniquely identify a record, which is required to perform an update or a delete.
 
Hmmm... that's a bit bizarre. I saw this thread under New Posts and I saw the first post but I swear that JohnH's reply was not there. Didn't mean to post duplicate information.
 
I merged two of the three duplicate threads (with mine and your answer), and deleted the duplicates.
gm.arain, don't double post the same question in multiple forums.
 
Back
Top