I’m not sure if this is the right place to report bugs, or if this one has been reported already.
Steps to recreate:
- Create a table with an integer column in the database
- Create an insert statement with an @ value.
- Populate the @ value by calling the SqliteParameter constructor with a hard-coded zero, that is, an integer zero, not a null.
- When the SqliteParameter object is created, the value property is null, not zero.
- 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.