Store Byte array in SQLite using Blob

后端 未结 2 1101
陌清茗
陌清茗 2021-01-01 05:12

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()
    {
           


        
2条回答
  •  灰色年华
    2021-01-01 05:56

    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.

提交回复
热议问题