Skip to content

.NET Library for loading data fast (doing bulk inserts) into a SQL Server Compact database file. Attempts to mimic the SqlClient SqlBulkCopy API.

License

Notifications You must be signed in to change notification settings

ErikEJ/SqlCeBulkCopy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SqlCeBulkCopy

.NET Library for loading data fast (doing bulk inserts) into a SQL Server Compact database file. Attempts to mimic the SqlClient SqlBulkCopy API.

How fast is it?

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

How to get it

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

The library also works with SQL Server Compact 3.5 and .NET Compact Framework see Releases

How to use it

Sample usage of the API - the WriteToServer method also accepts a DataTable, an IEnumerable or an IEnumerable

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

Online documentation

Offline documentation

About

.NET Library for loading data fast (doing bulk inserts) into a SQL Server Compact database file. Attempts to mimic the SqlClient SqlBulkCopy API.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages