For my application I\'m trying to store a byte array in my SQLite application, I\'m filling my SQLite database this way:
public bool InsertMessage()
{
Use an overload of SQLiteParameter that takes the DBType
parameter:
var dataParameter = new SQLiteParameter("Data", DbType.Binary) { Value = data };
pars.Add(dataParameter);
You should use parameters in the statement:
string SQL = "INSERT INTO ClockMessages (InsertDateTime, SendDateTime, Data) VALUES (@InsertDateTime, NULL, @Data)";
Everything else seems correct.
What you have now, calls the ToString()
method on insertdatetime
and data
and concatenates the result to the sql statement. Actually you are not using any parameter in the statement.