Subject Re: [IBO] Duplicate a record
Author Jason Wharton
Careful here... This won't work if you have BLOB columns in the dataset.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Chef" <chef_007@...>
To: <IBObjects@egroups.com>
Sent: Monday, November 20, 2000 7:42 AM
Subject: Re: [IBO] Duplicate a record


> Harald,
>
> just a suggestion, I use "RowData" for this task:
>
> procedure TM_DM_PlannerCfg.DuplicatePlanCol( ID_PlanCol: Integer );
> var
> sRowData: String;
> begin
> with Qry_PlanCol do begin
> Locate( 'PC_ID_PLANCOL', ID_PlanCol, [] );
> sRowData := Fields[0].Row.RowData;
> Insert;
> Fields[0].Row.RowData := sRowData;
> FieldByName( 'PC_ID_PLANCOL' ).AsInteger :=
eratorValue(
> 'GEN_PC_ID_PLANCOL', 1 );
> Post;
> end; // with
> end;
>
> HTH,
> Markus
>
>
> At 15:13 20.11.00 +0100, you wrote:
> >Hi,
> >
> >I want to append a new record, with the all the values assigned from the
> >current record in a grid.
> >My code works, but is there a better method to do this ?
> >
> >
> >procedure TfrmDemo.Button1Click(Sender: TObject);
> >var i:integer;
> >begin
> > with IB_Query1 do begin
> > i := FieldByName('ID').AsInteger;
> > Append;
> > KeyFields.ByName('ID').AsInteger := i;
> > if LookupKeyForBufferFields then begin
> > for i := 0 to FieldCount-1 do Fields[i].Assign(BufferFields[i]);
> > post
> > end;
> > end;
> >end;
> >
> >
> >Thanks
> >Harald Klomann
>
>
>
>
>