Answer the question
In order to leave comments, you need to log in
Is it possible to add a list with data at once in SQLite?
Hello. I need to add data to a SQLite table, I made a solution using iteration, but I would like to add a list en masse, is there a solution without iteration?
using (var db = new SQLiteConnection(conn))
{
db.Open();
SQLiteCommand selectCommand = new SQLiteCommand(db);
try
{
foreach(var v in List)
{
selectCommand.CommandText = String.Format("INSERT OR REPLACE INTO test (re) VALUES ('{0}')", v.ToString());
selectCommand.ExecuteScalar();
}
}
catch(SQLiteException error)
{
//
}
db.Close();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question