How can we help you today?
Copy Record From One Table to Another
2 CommentsSorted by Oldest First
If using SQL, you could use INSERT INTO:
INSERT INTO [destination] SELECT * FROM [source] WHERE [RowId] = RowId
If using DDA, you could use something like the following:
using (IVistaDBTableSchema schema = db.TableSchema(sourceTableName)) { using (IVistaDBTable sourceTbl = db.OpenTable(sourceTableName, true, true)) { using (IVistaDBTable destinationTbl = db.OpenTable(destinationTableName, true, false)) { // apply filter sourceTbl.SetFilter(filterExpression, optimizeFilter); // move to first record sourceTbl.First(); while (!sourceTbl.EndOfTable) { // create new record destinationTbl.Insert(); // copy data for (int i = 0; i < schema.ColumnCount; i++) destinationTbl.Put(i, sourceTbl.Get(i)); // save changes destinationTbl.Post(); // advance source to next record sourceTbl.Next(); } } } }
Thanks. I was looking for DDA.
Sunil Prasad
Is there a way to copy a record from one table to another. Both tables have same structure?