I have been working on C# Compact Framework 4.0 for my product.
I have an server and an mobile and i have to synchronize all the data from the server to my mobile device .
Usually around 6000 entries will be inserted into my mobile device on an single table .
Now i use table direct with index name of the table specified .
It takes around 55 sec for 6000 entries.
Is there an faster way to insert ??
SqlCeCommand cmdItem = conn.CreateCommand();
SqlCeResultSet rsItem;
cmdItem.CommandText = "item_info";
cmdItem.IndexName = "PK_item_info";
cmdItem.CommandType = CommandType.TableDirect;
rsItem = cmdItem.ExecuteResultSet(ResultSetOptions.Updatable | ResultSetOptions.Scrollable);
while(reader.read()){
SqlCeUpdatableRecord recItem = rsItem.CreateRecord();
recItem.SetString(1, cmdItem.SerialNo);
recItem.SetInt32(10, 0);
rsItem.Insert(recItem);
}
Using this library you can use
SqlBulkCopy
(SQLBulkCopy Class (Microsoft website)) with your SQL Server CE database.Library which supports SQL Server CE