Hi again everyone.
How do I insert data into a dataset that already exists in the same database. Basically, say I populate my dataset with some (not all) of the data in the table. Now I want to add some data to the dataset that already exists in the table - how do I go about inserting this without causing a Unique Key violation?
I cannot figure out how to either select data from the database and add this data in addition to the current data in the dataset (which should avoid the Unique Key constraints), nor am I able to figure out how to avoid the Unique Key violations that might be caused.
If anyone has any solution to the above , please let me know!
Insert data into dataset that exists already in database
Moderators: gto, cipto_kh, EgonHugeist
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi,
Much depends on your specific case, but when you are reading the records to be inserted by a sql statement in the same db, you may rewrite this sql to make sure an already existing record isn't generated anymore.
An other solution might be to use a locate before calling ZQuery.append. If a record with the same PK already exists the line can be skipped.
Mark
Much depends on your specific case, but when you are reading the records to be inserted by a sql statement in the same db, you may rewrite this sql to make sure an already existing record isn't generated anymore.
An other solution might be to use a locate before calling ZQuery.append. If a record with the same PK already exists the line can be skipped.
Mark