1

I'm using a SQLite database to store cover images of books I have in a database. I've got the inserting of BLOBs ok, but when I don't have a cover image for my book I can't seem to get it to insert a null BLOB.

I'm using parameters for my insert SQL statement, using ODBC, as shown below:

OdbcParameter^ paramCoverImage = gcnew OdbcParameter("@CoverImage", ByteArray);

cmd->Parameters->Add(paramCoverImage);

But when I try and do it with nullptr instead of the ByteArray, SQLite gives an error. I want to use the SQL NULL, but I can't find out how to do that using ODBC and SQLite. Any ideas?

Robin

1 Answer 1

3

Try:

OdbcParameter^ paramCoverImage = gcnew OdbcParameter("@CoverImage", OdbcType::Binary);
paramCoverImage->Value = System::DbNull->Value;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.