• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1972
  • Last Modified:

CrystalDecision.CrystalReport - How to dispay an image from Blob field in MySQL using VB.NET?

Hi experts,
How can I display an image from a Blob field in MySQL on report through CrystalDecision.CrystalReport using VB.NET.
I have set up a report in VB.NET using CrystalDecision.CrystalReport. The report source is from one of the tables in a dataset. This dataset is updated during run-time. Data Type for the image in the dataset is hexBinary and the image is stored in MySQL with type mediumblob. Somehow all other fields in dataset are displayed on the report except for the image.
Please help!
Many thanks
  • 2
1 Solution
Is the blob a bitmap?  Crystal only supports bitmaps that are stored that way.

LanAnhAuthor Commented:
Hi emoreau,
The comments in the code mention about creating schema for designing the report. I can't view the schema in this example as it is no longer exist after the report is created. I'd like to know what is the data type in the schema equivalent to System.Type.GetType("System.Byte[]").
I have included in my project a schema DatasetSource.xsd which have many tables for many other reports purpose. The table that hold the image (JPEG), I set the data type is hexBinary. In my code when I pass the table look like this:

dsReport.Tables.Add(New DatasetSource.asset_generalDataTable)
rs.Open(sqlMain, cnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)

recordsetToDataset(rs, dsReport, "asset_general") 'other procedure to tranfer data from recordset to dataset


Can you find any thing wrong? as the image is not shown in the report.
Many thanks!

PS. Thanks mlmcc.  I am investigating your info
LanAnhAuthor Commented:
Hi emoreau,
I have found my problem in my procedure recordsetToDataset.
 row(i) = rs.Fields(i).Value
I modified the code to readBytes when it read the column contains the image
It works perfectly now.
Thanks alot .

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now