Subject | How to duplicate a row from edit state into append/insert state? |
---|---|
Author | G. Nau |
Post date | 2006-03-12T22:37:45Z |
My application has a form containing the fields of a data row like
"select * from partlist where ref=1234" (ref is primary key, there are some
other fields, which are indexed and defined as unique as well).
Now I'd like to give the customer a function to duplicate the actual row
(leaving the old one intact) into a new row (insert or append).
Then I'll change some of the unique fields in the application and let the user
edit the row.
Finally the user can choose to commit/store the new row or drop the new
row.
Any idea how to do that?
I've tried something like this:
procedure TForm1.Button2Click(Sender: TObject);
VAR I : Integer;
OldRow : TIB_Row;
begin
AlteRow:=ib_query1.Fields;
IB_Query1.Append;
for I:=0 to IB_Query1.FieldCount-1 do
Begin
IB_Query1.Fields.Columns[i].Value:=OldRow.Columns[i].Value;
End;
But this is only copying NULL values. How can I get a pointer valid on the
oldrow, although the append has been done?
Regards
Gunther
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
"select * from partlist where ref=1234" (ref is primary key, there are some
other fields, which are indexed and defined as unique as well).
Now I'd like to give the customer a function to duplicate the actual row
(leaving the old one intact) into a new row (insert or append).
Then I'll change some of the unique fields in the application and let the user
edit the row.
Finally the user can choose to commit/store the new row or drop the new
row.
Any idea how to do that?
I've tried something like this:
procedure TForm1.Button2Click(Sender: TObject);
VAR I : Integer;
OldRow : TIB_Row;
begin
AlteRow:=ib_query1.Fields;
IB_Query1.Append;
for I:=0 to IB_Query1.FieldCount-1 do
Begin
IB_Query1.Fields.Columns[i].Value:=OldRow.Columns[i].Value;
End;
But this is only copying NULL values. How can I get a pointer valid on the
oldrow, although the append has been done?
Regards
Gunther
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de