Link to home
Start Free TrialLog in
Avatar of LanAnh
LanAnh

asked on

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
LA
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike McCracken
Mike McCracken

Is the blob a bitmap?  Crystal only supports bitmaps that are stored that way.
http://support.businessobjects.com/communityCS/TechnicalPapers/cr9feat_ver.pdf.asp

mlmcc
Avatar of LanAnh

ASKER

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.Clear()
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

rpt.SetDataSource(dsReport.Tables("asset_general"))

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

PS. Thanks mlmcc.  I am investigating your info
Avatar of LanAnh

ASKER

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 .
LA