Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
Chrisparr is currently offline  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 Go to previous message
Zbych is currently offline  Zbych
Messages: 325
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

Previous Topic: Another String error solved, maybe.
Next Topic: How do I alpha blend the image?
Goto Forum:
  


Current Time: Sat Apr 20 01:22:51 CEST 2024

Total time taken to generate the page: 0.09035 seconds