Turning to the last part of your question:
Perhaps someone knows a lot easier: how to do voluminous inserts of CSV files in SQLite ...
Given you need to import several thousand (or a million) records into sqlite from a CSV file,
When there is no direct support for importing csv data using select or insert commands, And the iterative line by line reading and pasting does not work
Then a practical alternative is to use "sqlite? .Exe" and the import command through the shell is executed from your C # code.
loadcsvtosqlite.cs
Process proc = new Process { StartInfo = new ProcessStartInfo { FileName = @"loadcsvtosqlite.bat", Arguments = @"", UseShellExecute = true, RedirectStandardOutput = false, CreateNoWindow = true } }; proc.Start(); proc.WaitForExit();
loadcsvtosqlite.bat
sqlite3.exe "db name" < loadcsv.sql
loadcsv.sql
drop table if exists <table name>; create table <table name> (field1 datatype, field2 datatype ....); .separator "," .import <csv file name> <table name>
source share