The Picture field type, sometimes called a "binary", "varbinary" or "blob" field, is designed to hold large blocks of non-standard, odd-sized data like photographs, sound, videos, etc. Creating picture-enabled databases with NeoDBpro is fairly straightforward, but this task will be easier once you learn how the picture field works.

Working With Pictures

As you learned in Working with Data, NeoDBpro automatically creates VisualNEO for Windows variables for each field in a table. Picture fields work a little differently. Instead of the picture field variable containing the actual bits that make up the image, the variable contains the name of a temporary file containing the image. To view the image, all you need to do is add the picture field variable (instead of a file name) to one of VisualNEO for Windows's Picture objects. For example, suppose we created a table called Clients that contained a picture field called "Photo". We would link the picture field variable [MyDB.Clients.Photo] to our VisualNEO for Windows Picture object like this:

That's all there is to it. Just like other types of database fields, the contents of the picture object change automatically as you navigate the database.

Adding Images to a Database

You've created a table that contains a picture field and linked it to a picture object, but how do you get images into the database? It's simple, just set the picture field variable to the name of a file that contains the image you want to add to the current record. For example:

SetVar "[MyDB.Clients.Photo]" "C:\My Images\Sally.jpg"

NeoDBpro will detect the variable change and read the contents of the file into the database. To make it even easier you can use VisualNEO for Windows's FileOpenBox action to select an image file. For example:

FileOpenBox "Add Picture" "Images|*.bmp;*.gif;*.jpg;*.tif;*.png;*.pcx" "" "[FName]" ""

If "[FName]" "<>" ""

  SetVar "[MyDB.Clients.Photo]" "[FName]"


You can use any VisualNEO for Windows compatible image file (BMP, GIF, JPEG, TIFF, PNG, PCX, WMF, ICO).

You can empty the contents of a picture field by setting the field variable to an empty string. For example:

SetVar "[MyDB.Clients.Photo]" ""

Limitations of Pictures Fields

Picture fields are stored as binary data, so they cannot be used to perform sorts or queries and cannot be exported or imported using the normal import/export actions. However, you can export individual picture fields one at a time using dbpExportBlob. If you want to create a searchable photo database, you will need to create a string field to store a description or list of keywords describing the contents of the picture field.

Advanced Uses for Picture Fields

Even though NeoDBpro defines its blob field as a picture, you can use it to store just about any type of file. Replace the picture object in the above example with a media player object and you have an audio/video clip database. Replace the picture object with an article object and you have an text clipping database. Basically, any type of file can be stored in a picture field.