DEV Community

Arunprasath
Arunprasath

Posted on

C#

bulk datatable insert in Sqlite database?

Top comments (3)

Collapse
 
thebuzzsaw profile image
Kelly Brown

Using which library?

Collapse
 
csearun profile image
Arunprasath

System.Data.SQLite library

Collapse
 
thebuzzsaw profile image
Kelly Brown

I don't know the specifics of that library. I tend to use SQLite raw (direct native calls). You can batch up an insert this way.

INSERT INTO my_table (col1, col2, col3) VALUES
(?, ?, ?),
(?, ?, ?),
(?, ?, ?),
(?, ?, ?),
(?, ?, ?),
(?, ?, ?)

You have to bind all the parameters and then execute it. Are you referring to a literal C# DataTable?