SqliteParameter bug

I’m not sure if this is the right place to report bugs, or if this one has been reported already.

Steps to recreate:

  1. Create a table with an integer column in the database
  2. Create an insert statement with an @ value.
  3. Populate the @ value by calling the SqliteParameter constructor with a hard-coded zero, that is, an integer zero, not a null.
  4. When the SqliteParameter object is created, the value property is null, not zero.
  5. If you call ExecuteNonQuery, you get an exception saying the value is required. So it’s acting as though you didn’t provide the @ parameter.

The workaround for this is to assign zero to a local integer variable, then pass that to the SqliteParameter constructor.

Also, this is a good example of how SQLite/SqlCipher error messages leave a lot to be desired. It would have been nice if the exception had the name of the missing parameter. I would have found the bug 10x faster.

Hi @blanning

Are you referring to the System.Data.SQLite client library, or Microsoft’s ADO.NET implementation via Microsoft.Data.Sqlite.Core?