Question Data Adapter returns Invalid Update Command when it is generating it in Wizard -??

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
I have been letting the wizard create the table adapters. After learning how to use the dataset designer to generate my fill criteria; I can not update using the table adapters update command. The latter I am sure has nothing to do with it. I have included the access tables in both the output directory and left them in their existing directory and that does not make any difference.

Update requires a valid Update command when passed Data Row Collection with Modified Rows.-the wizard has checked : adding, editing , and deleting so it surely is creating the command correctly.??????
 

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
If some one could tell me if I am on the right track or not. I believe that when I create a fill query in the data set designer that it does not automatically create everything for the update command. Based on this assumption I created a new query in the same table adapter to update. I used the wizard but it returns a different error when I test it: Syntax Error in Update Statement. I figured the Wizard would get it's part correct so any idea on where I need to look?
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,148
Location
Sydney, Australia
Programming Experience
10+
The issue will be that your table doesn't have a primary key. In order to generate an UPDATE statement and a DELETE statement, the wizard must be able to identify which row to update or delete. That's what the PK is for. Without a PK, those statements won't be generated.
 

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
You are correct, the table does not have a PK. I will add and run it. thanks
 
Top Bottom