What happened to my TableAdapter's Update and Delete commands?

DaveN59 picture DaveN59 · Jun 5, 2009 · Viewed 13.6k times · Source

I am fighting a recalcitrant VS2008 DataSet designer, it seems. I have been trying to do what seems to be a simple 2-table dataset solution, where one table is simply the textual meaning for an integer value stored in the other table. Basic data design 101.

Table1
CharField1
CharField2
IntForeignKeyField1
etc

Table2
IntPrimaryKey1
ValueForKeyField

That doesn't really affect the problem I am having, I don't believe, as I am not wanting to do anything but read the values in from the second table so I can choose them in a DataGridViewComboBoxColumn in the client -- I will never edit them on the client. But, I digress.

Since this lives in a web service, and I wanted a strongly-typed dataset delivered to the clients of this web service, I decided to use the DataSet Designer to build the TableAdapters and all the plumbing, thinking it might be less work and easier to maintain.

So, I created the pretty boxes and edited the select statements, instructing the designer to create all Insert, Update and Delete commands for the table adapter to use. It happily obliged, informing me that everything was done as I asked.

When I tried to use the Update statement, however, I got an error saying there was no valid Update statement! After some fruitless searching around for people with similar woes on the web, I dug into the XML for the dataset. Sure enough, no Update statement, and no Delete statement, either.

I tried completely deleting and recreating the DataSet from the project, with the same results. No Update or Delete statements were created, even though it was reported as done.

I ended up building the Update statement XML by hand, by inspecting another designed dataset from another project, so the web service is now working. However, I have no faith whatsoever my changes would last through an edit initiated from the designer, and I am stumped as to why it is not working. Any ideas?

Thanks for any feedback, Dave

Answer

Kenny picture Kenny · Jul 29, 2009

could it be that there is no unique primary key defined for the table?