Thread: Copy data from dataset to another with copied records marked for insert
 |
This question is not answered.
Helpful answers available: 2.
Correct answers available: 1.
|
|
Replies:
4
-
Last Post:
Apr 18, 2018 6:57 AM
Last Post By: Mark Williams
|
|
|
Posts:
120
Registered:
5/8/10
|
|
I am looking for a fast way to copy all records in one FDQuery to another FDQuery, but I would need the copied records to be marked as usInserted so they will be inserted as new records into the database. Is this possible or do I have to copy on a record by record basis from one query to the other?
|
|
|
Posts:
11
Registered:
3/3/01
|
|
|
|
|
Posts:
120
Registered:
5/8/10
|
|
is there a way of calling CopyDataSet so that the records it copies to the destination table are treated as new records rather than copies?
|
|
|
|
Posts:
687
Registered:
3/24/05
|
|
is there a way of calling CopyDataSet so that the records it copies to the destination table are treated as new records rather than copies?
But how does your table know that they are copies??
I would not depend on a component-framework to copy data but only sql.
In your case I would use FDQuery just to do the insert sql:
.
https://www.w3schools.com/sql/sql_insert_into_select.asp
and then refresh your screen of your copy table with a Select sql..
|
|
|
|
Posts:
120
Registered:
5/8/10
|
|
is there a way of calling CopyDataSet so that the records it copies to the destination table are treated as new records rather than copies?
But how does your table know that they are copies??
I am not sure. However, if you do a CopyDataSet and then change the data in one of the records, it causes the original record to be updated. It doesn't insert a new record, so it would appear to know.
I would not depend on a component-framework to copy data but only sql.
In your case I would use FDQuery just to do the insert sql:
Unfortunately, I don't want to insert the records initially. The copies are presented to the user in a new grid and they are given the option of inserting them if they so choose or simply cancelling. This could amount to quite a lot of data so I don't do a massive insert only to have to delete all the records later.
|
|
|
|
Legend
|
|
Helpful Answer
(5 pts)
|
|
Correct Answer
(10 pts)
|
|
Connect with Us