Save¶
Saves changes made to the data table to the database.
1 | |
Returns¶
The current DataTable instance.
Remarks¶
Until this method is called, all changes to the data table are stored in memory. Save inserts added rows, updates changed rows and deletes rows marked as deleted.
For batch inserts or updates, get the table once, change rows in memory, and call Save once after the loop. Do not call $Database.EnsureData in that loop: it saves on each call. A single Save call does not imply a single SQL statement; the provider controls batching.
Tables returned by $Database.ExecuteQuery cannot be saved.
Examples¶
Update rows and save¶
1 2 3 4 5 6 7 | |
Upsert a collection with stable IDs and one save¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |