views:

144

answers:

5

I need to perform bulk insetion into a sqlite database in visual studio. Does anybody know how to do this?

+1  A: 

You can just write a regular insert statement and loop through your dataset, inserting the relevant data into the query string before running it against the database.

Mike Trpcic
+2  A: 

You might want to look at this answer to a similar question here on SO.

lexu
+3  A: 

With SQLite you can do this by opening a transaction, looping through all your data and executing the relevant SQL INSERT commands, and than commit the transaction. This is the fastest way to perform bulk inserts in SQLite.

Liron Levi

(Creator of the SQLite Compare diff/merge utility)

Liron Levi
+2  A: 

I needed to do the same thing, I found this answer on the Sqlite.Net forum, might be of interest for someone.

http://sqlite.phxsoftware.com/forums/t/134.aspx

Emmanuel
+1  A: 

I wrote a class to help facilitate bulk inserts in SQLite. Hopefully it's helpful:

http://procbits.com/2009/09/08/sqlite-bulk-insert/

-JP

JP