Android Question SQLLite and images


Licensed User
Hi everyone. My new app is coming along very nicely now.

I have successfully created an SQLLite database and a table within it. Ultimately, records will be downloaded and inserted into my table, but for now I simply want to add a BLOB field to my table and then insert an image programmatically. I am thinking I could add bitmaps to the project, but how, then, can I insert them in the new field?

For testing purposes I start by deleting the database if present, then adding 4 dummy records to my table using CREATE TABLE in an ExecNonQuery and then using ExecNonQuery2 (to handle field types) to insert the four records.

Can you please advise (preferably with a bit of code as an example) how I do this?

Thanks in anticipation of any help - very much appreciated.



Well-Known Member
Licensed User
Have you searched the forum ? There are tutorials available showing how to do just that.
In fact the first Tutorial by Erel in "Similar Threads' at the top of the page has sample code to do just that

As it turns out only last night I created a simple app using that code just to test storing and retrieving an image from a db.

I offer it to you to display the very basics of what your trying to achieve.


  • ImageDB
    55.9 KB · Views: 498
Upvote 0


Active Member
Licensed User
i am trying to update imagefield using this code

Dim OutputStream1 As OutputStream
        Dim Buffer() As Byte
        Buffer = OutputStream1.ToBytesArray
    'write the image to the database
        sql1.ExecNonQuery2("UPDATE player SET profilepic VALUES(?) where playername= '" & pname & "'", Array As Object(Buffer))

but getting syntax error in sql statement near VALUES. please help
Upvote 0