Re: Inserting multiple records to linked tables


2004-04-07 06:25:16 AM
cppbuilder46
EDW,
Interesting. Thanks for the update.
--
Phil Robertson
BSIT XXXX@XXXXX.COM
Work XXXX@XXXXX.COM
Home XXXX@XXXXX.COM
-----------------------------------------------------------
"EDW" < XXXX@XXXXX.COM >wrote in message
Quote

I figured out what the problem was. In case anyone else was reading this
thread.

I had to refresh the DB after each post, otherwise it was freaking out
when I selected the new last record. So now this works.

for(int i = 0; i < datacount; i++)
{
Table1->Last();
index = Table1->FieldValues["PRI_ID"];
index++;

Table1->Insert();
Table1->FieldValues["PRI_ID"] = index;
Table1->FieldValues["DATA"] = data[i];
Table1->Post();

Table2->Insert();
Table2->FieldValues["PRI_ID"] = index;
Table2->FieldValues["DATA"] = dataA[i];
Table2->Post();

Table3->Insert();
Table3->FieldValues["PRI_ID"] = index;
Table3->FieldValues["DATA"] = dataB[i];
Table3->Post();

Table1->Refresh();
Table2->Refresh();
Table3->Refresh();
}