Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Deleting master-detail records in ADOtable

Posted on 2001-06-13
1
Medium Priority
?
502 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
Stefaan earned 400 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

719 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