Subject Re: [IBO] Trouble posting changes to a multirecord dataset
Author Ramil
Check IB_Cursor1.RequestLive is True
and don't forget about Transactions.

I have this working fine:

IB_Transaction1.StartTransaction;
try
// it's necessarily for opening cursor and going to the first record
IB_Cursor1.First;

while not IB_Cursor1.Eof do
begin
IB_Cursor1.Edit;
IB_Cursor1.FieldByName('ABC').AsString:='123';
// IB_Cursor1.Fields[1].AsString:='123'; is a little faster
IB_Cursor1.Post;
IB_Cursor1.Next;
end;
IB_Transaction1.Commit;
except
IB_Transaction1.RollBack;
end;

I have checked up.

Ramil

>
>
>
>
>
> Hi,
>
> I'm working on a large application that does all of it's saving one
> record at a time. Basically the code is like this.
>
> Dataset.Close;
> Dataset.ParamByName('ACTIVITY_ID').AsInteger := ActivityId;
> Dataset.Open;
>
> Dataset.Edit;
> Dataset.FieldByName('WS_REPEAT_REASON').AsString := RepeatReason;
> Dataset.Post;
>
> This may be called up to 12000 times in one "Save". Hence saving is
> currently extremely slow. I am looking to speed this up and have
> tried the following
>
> While not Dataset.eof do begin
> { does not load activities which have been repeated }
> Dataset.Edit;
> Dataset.FieldByName('WS_REPEAT_REASON').AsString := RepeatReason;
> Dataset.Post;
> Dataset.Next;
> break;
> end;
>
> In this case "Dataset" is a TIB_Cursor containing all the records that
> need to be modified. The trouble is this code doesn't seem to modify
> the records in the db. Can anyone help please?
>
> Thanks,
> Thomas Johnson
>
>
>
>
>
> __________ Eioi?iaoey NOD32 1.1846 (20061031) __________
>
> Yoi niiauaiea i?iaa?aii Aioeae?oniie nenoaiie NOD32.
> http://www.eset.com
>
>


--
Best regards,
Ramil R. Khabibullin khabibr@...