Click to See Complete Forum and Search --> : DBConcurrencyException: Delete a entry in master -detail table


dionchen1
March 18th, 2003, 04:25 PM
Hi, all:

I have a master-detail relationship in my MS Access DB. In my WinForm application, I also created same Master-Detail relationship in my dataset. When I delete a row in my datagrid, the entries in the detail table is also deleted in the dataset due to the relationship. After an user finishs editing the data, I call daMaster.Update and then daDetail.Update. I got the DBConcurrencyException when trying to update the detail table. I think the reason is as following: when the master table is updated, it deletes the row marked with "Deleted". Since the relationship is setup in the MS Access DB, it deletes the entries in the detail table of Access DB. When the second Update is called, the record is gone and exception is thrown.

How do I fix this problem? I can not change the order of update, otherwise it will break the new entries ( must exist in the Master table first ). I guess that if I take all the relationship out in the MS Access DB, it will work fine, but I think that probably is not good thing to do.

Please help. Thanks in advance.

Dion

hellomadhu
March 21st, 2003, 05:15 AM
why do u want to delete a row before editing ?.

try to do it without deleting the record.

are u binding ur datagrid to the backend ?

try to post ur code , so that u get a good solution

regards
madhu