Question

I have three tables, with two data relations connecting them (Table 1 -> Table 2 <- Table 3). I've been trying to use the command builder to generate the update, delete and insert commands as in this article but I cant seem to get this approach to work. Currently I get an error saying there is a problem with the syntax in the insert command. Also I'm using an Access database.

Is it possible to use the command builder for this or will I have to write the insert, update and delete commands myself?

Was it helpful?

Solution

The question is very vague. Without knowing what the Insert command looks like and what the exception message says, only this section from the MSDN article titled "Limitations of Automatic Command Generation Logic" is worth quoting:

The automatic command generation logic generates INSERT, UPDATE, or DELETE statements for stand-alone tables without taking into account any relationships to other tables at the data source. As a result, you may encounter a failure when calling Update to submit changes for a column that participates in a foreign key constraint in the database. To avoid this exception, do not use the DbCommandBuilder for updating columns involved in a foreign key constraint; instead, explicitly specify the statements used to perform the operation.

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