Project Description.NET Library for loading data fast (doing bulk inserts) into a SQL Server Compact database file. Attempts to mimic the SQLClient SqlBulkCopy API.
Some timings from testing - load 2 column table with no constraints/indexes:
1.000.000 rows: 6 seconds = 166.666 rows/second
5.000.000 rows: 28 seconds = 178.000 rows/second
Documentation now available under the Documentation tab, support for .NET Compact FrameworkFor use with SQL Server Compact 4.0, simply install the
NuGet packageSQL Server SqlBulkCopy API documentationSample usage of the API:
- the WriteToServer method also accepts a DataTable, an IEnumerable or an IEnumerable<T>
using ErikEJ.SqlCe;
private static void DoBulkCopy(bool keepNulls, IDataReader reader)
{
SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions();
if (keepNulls)
{
options = options |= SqlCeBulkCopyOptions.KeepNulls;
}
using (SqlCeBulkCopy bc = new SqlCeBulkCopy(connectionString, options))
{
bc.DestinationTableName = "tblDoctor";
bc.WriteToServer(reader);
}
}