Solved

Deleting master-detail records in ADOtable

Posted on 2001-06-13
1
476 Views
Last Modified: 2010-04-06
Dear Sir,

I have two tables Access2000 in master-detail relationship. I access them using ADOtable. In a form, when I try to delete the master records, a message comes out saying there's detail records, then I delete detail records first and when I try to delete master records the same message stops me from deleting them. In Delphi demo folder there's in db one sample named dberrors.dpr, however it uses BDE to delete master-detail records. I don't want to use BDE. How do I do it using ADOtable, Ado connection?

Thanks,

Rhiegen
0
Comment
Question by:rhiegen
1 Comment
 
LVL 3

Accepted Solution

by:
Stefaan earned 100 total points
ID: 6189725
Hi,

If the database is an Access2000 database, you can set up cascaded deletes.  If you set those up it should give no problem anymore ( though personally I don't use that ).  Just open the DB, go to the Relationship diagram and find your master table.  Now klick on the links with the other tables and select 'Edit Relationship', and a new dialop will open in which you can enable 'Cascade Delete Related records'

This will set up your DB so that if you delete a master record, it will automatically delete the detail records.

If you do not want to set up Cascade deletes in your database, you will have to do it programmatically in your application.  Maybe in the BeforeDelete event of the Master table you can loop over all records from every detail table to delete them so that the actual delete of the master record will succeed.

I hope this will be of any help to you,


Best regards,


Stefaan
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Delphi 2010 Export to pdf 2 253
ddeman not working in activex 3 79
Delphi XE2 application frozen on Windows 10 10 229
LAN or WAN ? 11 63
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now