 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
KA Guest
|
Posted: Sat Mar 19, 2005 10:13 pm Post subject: Updating Multiple Oracle 9i tables with Delphi 4 |
|
|
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
|
Posted: Mon Mar 21, 2005 6:32 am Post subject: Re: Updating Multiple Oracle 9i tables with Delphi 4 |
|
|
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 |
|
 |
|
|
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
|
|