(Not) understanding file handling and graphics

Andras

Active Member
Licensed User
Longtime User
First, a word of self-excuse! I'm used to a programming environment where file-handling involves loading the (separate) file, typically using a WHILE / NOT EOF loop and thus loading the various field values into array variables, where they can be easily manipulated.

The B4A system has me rather flummoxed as it's so different; I have read the various help files and have ploughed through the sample code, and can now at least handle simple text and number databases, but I still become totally lost where blobs are concerned.

My current 'learn B4A' project involves creating a simple address book; the db has therefore two tables in it, one with fields for ID, Name, Street, Town, Telephone; and the other with two fields - one for the ID (to permit easy JOINs) and one blob-field to hold a person's picture.

What I want to be able to do is to tap a row in the ScrollView and display the appropriate picture in an ImageView; I've tried various snippets of code - thanks to the kind people who've helped here! - but can't get the appropriate image (or, usually any image) to match the appropriate row. Typically I get a Column ID does not exist error, but fiddling with the parameters produces only more interesting error messages.

I accept that I don't really know what I'm doing here! Can someone kindly hold my hand please!

John
 

Andras

Active Member
Licensed User
Longtime User
Right, I can - I think - see how that works, and it's very helpful so sincere thanks, Dude. I can certainly build on that - after demolishing quite a bit of what I've got!

I note that in this version the pictures are handled as text strings rather than as blobs, so please can you explain the advantages and disadvantages of doing it this way?

John
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Blobs save the picture in the database, so, your database can become very big, that's one of the disadvantages, however, there's no right or wrong answer just personal preference.
 
Upvote 0

Andras

Active Member
Licensed User
Longtime User
That's a very helpful answer!

I'm more used to an environment with stronger 'typing', so treating a jpeg as a string doesn't come naturally to me, to put it mildly! With the kind help from folks on this forum I have real hopes that I'll crack it all yet!

John
 
Upvote 0
Top