Reputation: 2096
When querying data from SQLite, it says:
SQLite error Insufficient parameters supplied to the command
I think there is either a bug, or the error message is misleading. Because I only have one parameter and I am providing it, so I cannot understand where is the problem.
Here is my code:
public List<T> Read(string sql, List<SQLiteParameter> addParametera = null, params string[] properties)
{
var data = new DataTable();
var command = new SQLiteCommand(Connection);
command.CommandText = sql;
addParametera?.ForEach(p => command.Parameters.Add(p));
var reader = command.ExecuteReader(); // <- ERROR
if (reader.HasRows)
{
data.Load(reader);
}
reader.Close();
var maps = Maps.ByProperties(properties).ToList();
var results = data.Rows.Cast<DataRow>().Select(r => New(r, maps)).ToList();
return results;
}
Upvotes: 1
Views: 340
Reputation: 29243
The parameter name of the parameter object is NULL, I'm guessing that's the problem
Upvotes: 1