Article View: borland.public.cppbuilder.database.ado
Article #1940Deleting Records in a Query Result Table
From: Robert Emmons
Date: Sat, 27 Dec 2003 23:17
Date: Sat, 27 Dec 2003 23:17
20 lines
1855 bytes
1855 bytes
I have a query which shows Customer names and orders in a result table: SELECT DISTINCTROW CustList.Name, CustList.ID, CustOrders.* FROM CustList INNER JOIN CustOrders ON CustList.ID = CustOrders.ID ORDER BY CustList.Name; If I run the query in Microsoft Access, I can delete any row from the CustOrders table by selecting the corresponding query row, and hitting the <Del> key. However, the deletion does not work the same in a TADOQuery result set. If I try to delete a row, it tries to delete the corresponding rows in *both* the CustOrders *and* CustList tables. This generally results in an error message: "The record cannot be deleted or changed because table CustOrder includes related records." Can I force the delete to apply only to the CustOrders table as it seems to in Microsoft Access? Alternatively, can I trap the error in the "BeforeDelete" TADOQuery event, and execute my own delete query?
Technical Details
Message-ID:
<am4suvgp2h473hlagl3ur1jimaamfdi7u5@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,2bc0d782656ee7e1,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-12-27 15:22:45 PST From: Robert Emmons <remmons@aurigen.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: Deleting Records in a Query Result Table Date: Sat, 27 Dec 2003 18:17:07 -0500 Message-ID: <am4suvgp2h473hlagl3ur1jimaamfdi7u5@4ax.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 68.193.14.50 X-Trace: newsgroups.borland.com 1072566941 68.193.14.50 (27 Dec 2003 15:15:41 -0700) Lines: 21 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail