Store Images In Database

This sample shows how you can save images to a database and retrieve them afterwards. This sample updates and reads photos of employees in the Northwind database. You can get sample Northwind databases here.

This Linx Solution uses the Database, File, and Utilities plugins.


Download

StoreImagesInDatabase.zip


To run the sample

  1. Open the StoreImagesInDatabase solution with Linx Designer.
  2. Click on the Settings button.
  3. On the Settings tab change the values of the Settings to suit your environment (if you need help with the database connection string, have a look at this help topic).
  4. Open the sample Process you want to run from the Solution Explorer pane on the left.
  5. Click the Debug button to run the Process.


How it works

There are two Processes:

  • StoreImages
    Finds and reads every image file in the input folder and sets the image as the photo of the corresponding employee in the database. An OLE-header is added to each image before it is stored. The OLE-header is optional and is typically only necessary when the file format of the image is not always known.
  • LoadImages
    Writes the photo of every employee to an output folder. The OLE-header (which is 78 bytes long) is discarded before the file is saved.