BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Updating Multiple Oracle 9i tables with Delphi 4

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
KA
Guest





PostPosted: Sat Mar 19, 2005 10:13 pm    Post subject: Updating Multiple Oracle 9i tables with Delphi 4 Reply with quote



I am a student working on an independent study project (due next Thursday).
The deliverable for my project is an Oracle 9i database application. I have
completed the database with no problems and I'm using Delphi 4 to create the
interface.

I have basically no real programming experience, so I'm learning Delphi as I
go. I have successfully created forms that link to individual tables in my
database and I'm able to update the tables with no problem. I successfully
created a master-detail form linking my ORDER table to my ORDER_ITEMS
table. I also have added a combo lookup box from the PRODUCTS table so the
user can update the corresponding PROD_ID field in the ORDER_ITEMS table.
When I run the app everything looks as it should. When I add a new order I
receive a key violation; apparently both tables are updating simultaneously
so that the PK for orders is not entered before it attempts to enter the FK
for order_items.

So...I'm thinking there should be some simple code that tells Delphi to
update table one before updating table two. For instance, maybe include
OnExit code for the last field in the orders table that executes the update
to that table before anything is added to table 2 fields?

Thank you for any suggestions. For the most part I'm letting Delphi do my
coding...so any assistance here would be geatly appreciated.

Kathy


Back to top
KA
Guest





PostPosted: Mon Mar 21, 2005 6:32 am    Post subject: Re: Updating Multiple Oracle 9i tables with Delphi 4 Reply with quote



Thank you! I knew there would have to be an easy solution. Helps if you
know what you're doing. In a couple of months maybe I'll know enough to
give back.

Kathy


"Brian Bushay TeamB" <BBushay (AT) Nmpls (DOT) com> wrote

Quote:
go. I have successfully created forms that link to individual tables in
my
database and I'm able to update the tables with no problem. I
successfully
created a master-detail form linking my ORDER table to my ORDER_ITEMS
table. I also have added a combo lookup box from the PRODUCTS table so
the
user can update the corresponding PROD_ID field in the ORDER_ITEMS table.
When I run the app everything looks as it should. When I add a new order
I
receive a key violation; apparently both tables are updating
simultaneously
so that the PK for orders is not entered before it attempts to enter the
FK
for order_items.

So...I'm thinking there should be some simple code that tells Delphi to
update table one before updating table two. For instance, maybe include
OnExit code for the last field in the orders table that executes the
update
to that table before anything is added to table 2 fields?

Write code for beforeInsert event in the detail table to check if the
master
table is still inserting and post it.

If MasterTbl.state = dsInsert then
MasterTable.post;
--
Brian Bushay (TeamB)
[email]Bbushay (AT) NMPLS (DOT) com[/email]



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.