Board index » delphi » how to copy (duplicate) a record in TTable w/o second TTable

how to copy (duplicate) a record in TTable w/o second TTable

Hello,

Is it possible to copy one record into the same Dataset without creating
the secondary Dataset (that points to the same table).

Now I have two TTables and when i want to copy a record (row) I move
secondary TTAble to the same row, put primary TTable into Insert mode and
then  go thru all fields and copy all fkData fields.

It would be much better if I could do it with just one TTable.

Thanks,
  Nikola

 

Re:how to copy (duplicate) a record in TTable w/o second TTable


Quote
> Is it possible to copy one record into the same Dataset without creating
> the secondary Dataset (that points to the same table).

Read the data you wish to duplicate (but not PK, & other unique values) into a record
structure that you've created. Then simply append a record to your table. write the
values in your record to the new database record & post.

easy. Good luck.

  vcard.vcf
< 1K Download

Re:how to copy (duplicate) a record in TTable w/o second TTable


The only way to do it with a single TTable is to store the data in memory.
Copy the value of each field to a Variant array or Pascal record then copy
it from there into the new record.

--
Bill

(TeamB cannot answer questions received via email.)
(To contact me for any other reason remove nospam from my address)

Other Threads