Home » Community » Newbie corner » Image to an SQLite blob windows 10 (Needcode to load an image froma file to an sqlite blob)
Image to an SQLite blob windows 10 [message #46924] |
Fri, 16 September 2016 12:28  |
Chrisparr
Messages: 7 Registered: September 2016
|
Promising Member |
|
|
Hi Everyone, I loaded images into blobs using VB.net express. I can read those into a statictext box and i can read images from files into the static text box. But I have not in upp been able to loadañ image into a sqlite blob. Please help
|
|
|
Re: Image to an SQLite blob windows 10 [message #46928 is a reply to message #46924] |
Sun, 18 September 2016 22:40  |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
I haven't done this in sqlite, but in postgres and it was quite easy:
Saving image to database:
//Database.sch
TABLE_ (TABLE_NAME)
SERIAL_ (SOME_ID) PRIMARY_KEY
BLOB_ (COLUMN_NAME)
END_TABLE
//code
Image img;
JPGEncoder jpg(90);
try{
SQL & SqlInsert(TABLE_NAME)
(COLUMN_NAME, SqlBinary(jpg.SaveString(img)))
}catch...
Loading it back:
try{
SQL & SqlSelect(COLUMN_NAME).From(TABLE_NAME).Where(......).Limit(1);
if (SQL.Fetch()){
Image img = StreamRaster::LoadStringAny(SQL[COLUMN_NAME]);
//Use StaticImage to show your image on a screen
}
}catch....
[Updated on: Sun, 18 September 2016 22:59] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu May 01 17:25:20 CEST 2025
Total time taken to generate the page: 0.01155 seconds
|