Subject Again - Duplicate a record which is in the buffer
Author Harald Klomann
Hi,

I want to insert a new record, with the all the values copied
from the current record of TIB_Query. My code works with IBO 3.6x,
but with IBO 4.x the LookupKeyForBufferFields method is defined as protected,
thus nore more useable. I can´t just copy the rowdata, because I use blobs.

procedure TfrmDemo.Button1Click(Sender: TObject);
var i:integer;
begin
with IB_Query1 do begin
i := FieldByName('ID').AsInteger;
Insert;
KeyFields.ByName('ID').AsInteger := i;
if LookupKeyForBufferFields then begin
for i := 0 to FieldCount-1 do Fields[i].Value := BufferFields[i].Value;
post
end;
end;
end;

OK, I could walk through the buffer and find my record of interest like:

BufferFirst;
while (BufferFieldByName('ID').AsInteger <> sourceId) and (not BufferBof)
do BufferNext;
for i := 0 to FieldCount-1 do Fields[i].Value := BufferFields[i].Value;

But isn´t there a better method ?


Thanks
Harald


Thanks
Harald Klomann


___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/