Displaying Image from SQL Server in Crystal Report

2019-06-09 22:55发布

问题:

I have a couple of images in my SQL Server 2008 table of which the datatype is image.

In my VS.net 2008 project I have a crystal report which is displaying all the fields from that table, but the image is showing as a blank image.

Any thoughts, How I can make it work?

回答1:

You have to convert the image before you can show it.

In crystal reports, you can click on the image control and set the value property of the control to the following (replace ImageFieldName with your field name)

System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields!ImageFieldName.Value), 105))