0

Hello, I am using Delphi2010 and TOracleDataSet to access tables in Oracle. My question is how do I insert rows to multiple tables? I was told to use the AppendRecord method. Here is an example:

Example of value statements (this has been shortened obviously):
Suffix := trim(edSuffx.text);
Salutn := trim(edDear.text);

Example of AppendRecord:
DM.protinfoDS.Open;
DM.protinfoDS.AppendRecord([casenum,TPID,SSN,LName,FName,LName2,FName2,Title,
Co,Addr1,Addr2,City,State,ZIP,Suffix,Salutn]);
DM.protinfoDS.Close;

Example of the next table:
RepState := Trim(edRepState.text);
RepZip := Trim(edRepZip.text);

DM.repinfoDS.Open;
DM.repinfoDS.AppendRecord([casenum,RepName,RepCo,RepAddr1,
RepAddr2,RepCity,RepState,RepZip]);
DM.repinfoDS.Close;

Now........there are two other tables also. These all work and all four tables are inserted like they should be but I am leary of what could happen. I think there should be some kind of code in between appending information to the four tables. For example, the unique key for all four tables is a casnumber. What if 2 tables insert just fine and then an error occurs inserting values in the third table and then I have 2 tables with rows and 2 tables without? Matching casenumbers will exist in the 2 that inserted rows but not the other two.

Please help and thanks in advance!

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by marge0512
0

Data should be only one table according to principle of relational database and other tables should reference that table.

0

Hi and thanks for responding!

Do you mean as far as a master/detail relationship?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.