This project has moved. For the latest updates, please go here.
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.

Project has been moved to GitHub

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


For use with SQL Server Compact 4.0, simply install the NuGet package

SQL Server SqlBulkCopy API documentation

Sample 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);
            }
        }

Last edited Mar 31 at 9:05 PM by ErikEJ, version 25