Q&A - Question How to save a bitmap in SQLite field Question Danv asked on June 27, 2022, keyword: Developer Kernel Hi all, I am able to read a bitmap from a field and display it in a TImage. This using the sqlQueryGetBlob function. Now I want it the other way around: save a bitmap in the field. So I found the sqlTableSetBlob procedure but I can not figure out the use of it. Anyway ever used this and can show me a few lines how it is done? Thanks in advance, Danny. Answers Artur Redzko (TatukGIS) replied June 27, 2022 Hi, here is a sample code: procedure SaveBitmap; var cfg : TStringList ; odb : TGIS_DbSqlite ; stm : TGIS_MemoryStream ; bmp : TGIS_Bitmap ; begin odb := TGIS_DbSqlite.Create ; odb.InitializeProvider ; cfg := TStringList.Create ; cfg.Values[ 'Sqlite' ] := 'c:\tmp\test.db' ; // solve "a database is locked" issue cfg.Values['PRAGMA journal_mode'] := 'WAL'; cfg.Text := cfg.Text + #13#10 + GetSQLDialect( 'SQLITE' ) ; odb.sqlInitialize( cfg, cfg ) ; odb.sqlConnect( '', cfg ) ; cfg.Free ; bmp := TGIS_Bitmap.Create ; bmp.LoadFromFile( 'c:\tmp\test.jpg') ; stm := TGIS_MemoryStream.Create ; bmp.SaveToStream(stm); bmp.Free ; odb.sqlTableOpenWrite(1, 'UPDATE test SET Foto =:Foto WHERE id=1'); odb.sqlTableSetBlob(1, 'Foto', Unassigned, stm); odb.sqlTablePost(1); stm.Free ; odb.sqlDisconnect ; odb.Free ; end; If you would like to answer the question please Sign In. * * Stay signed in on this computer Please review our recent Privacy Policy.If you have any questions or requests, please contact us. Forgotten password Rules The Questions and Answers (Q & A) is intended to provide a means of communication between TatukGIS customers. Licensed users (with active maintenance play) of TatukGIS products may contribute to the Q & A content. Read-only access is available to anyone. Keep the content positive and professional. Be courteous to others by posting information when a question or issue asked on the Q & A is answered or resolved by other means (such as with help from TatukGIS technical support). Offer others at least a hint how the posted question was answered or the issue was resolved. The Q & A is not a replacement for TatukGIS technical support. TatukGIS team may or may not regularly follow or contribute content.