tags:

views:

613

answers:

2

Hi Guys,

Anybody tried to display image field (image/byte array) data type on reportviewer.

Regards, Peter

A: 

I have with an image data type in SQL Server. Works fine with SSRS 2005 and 2008.

Mozy
A: 

Yes. ReportViewer requires a Base64 Image encoding in order to display the image properly.

If your image is in a Byte array, it will need to be converted to Base64:

 Public Function ConvertImageToBase64String(ByVal img As Image) As String
    Dim output As String = ""

    Dim outputArray() As Byte
    Dim stream As New MemoryStream
    img.Save(stream, Drawing.Imaging.ImageFormat.Bmp)
    outputArray = stream.ToArray()
    stream.Close()
    output = Convert.ToBase64String(outputArray)

    Return output
  End Function
Jon

related questions