Question

I have inherited a project with an Access backend, using TableAdapters which I've not used before.

Most of the tables in the schema work fine, but a single one is not generating the INSERT statement and insert method.

I have checked everything mentioned here: http://msdn.microsoft.com/en-us/library/ms233812(vs.80).aspx

The adapter is using a simple query on a single table, the checkboxes for generating statements and methods are ticked and the table has a primary key. UPDATE and DELETE work fine.

Is there anything else that could be affecting this?

Was it helpful?

Solution

Go into the xsd file and look at the properties of the TableAdaptor, you should have an entry for InsertCommand. If this is missing you can add it manually.

This assumes you are using an xsd file obviously.

Edit:

Have you tried adding a new TableAdaptor using the wizard attached to the same table to see if it generates without the insert command?

OTHER TIPS

I had the same problem, but I noticed something the table had no primary key, solve it by adding the primary key, now it works fine, have you tried that?

I had the same issue, and discovered that the INSERT command was not created if I had omitted fields from the dataset that were NOT NULL in the database. Once I included the NOT NULL fields in the dataset, the INSERT command was created.

I had the same problem. I went to my first tableadapter query and changed it from "Select fid1, fid2, fid3 from filename" to "Select * from tablename" and checked that I wanted the inserts, updates, etc generated. It generated all new commands. Worked great.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top