I started with this problem How to Insert and Update in SQLite using SQLite-net
However it takes a lot longer than it should. This is noted in the answer/comments:
Thanks, looks like it's working...but VERY VERY VERY slow... 32 thousand records to copy to database took like 3-4 minutes. and it only have 3 columns... strange why so slow? – Tommix Nov 27 '11 at 12:30
Try to do the Update in a transaction; if there is no explicit transaction, SQLite creates one implicitly for each insert, which is very slow for massive inserts. Also, 32k records is pretty big, perhaps you should try to do it in smaller batches. – Thomas Levesque Nov 27 '11 at 17:38
Here is the code I am using to update the local SQLite DB from the MS SQL created datatable. How do I do this in a transaction?
SQLiteDataAdapter dataUpdate = new SQLiteDataAdapter("SELECT * FROM ItemMaster", sqLiteconnection);
var cmdBuilder = new SQLiteCommandBuilder(dataUpdate);
dataUpdate.Update(dataInsertStagingTable);
mConnect.Close();
sqLiteconnection.Close();
Aucun commentaire:
Enregistrer un commentaire