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!