Showing results for 
Search instead for 
Did you mean: 

Displaying image in crystal reports

Former Member
0 Kudos

I am storing the logo of my customer in the database(SQL Server 2005) in binary format.I use VS2005 for developing my application.I would like to use the logo from the database in all the crystal reports(which are already connected to concerned stored procedures) i use .

Can anyone tell me how i could accomplish that using c#.Net.



View Entire Topic
Former Member
0 Kudos

Hi Sunitha,

Try with this code:

 Add data into the dataset
ds.DataTable1.AddDataTable1Row(id, GetImageData(ofdImage.FileName), userName)
' GetImageData function
    Private Function GetImageData(ByVal fileName As String) As Byte()
        Dim fs As System.IO.FileStream = New System.IO.FileStream(fileName, IO.FileMode.Open, IO.FileAccess.Read)
        Dim br As System.IO.BinaryReader = New System.IO.BinaryReader(fs)
        Return (br.ReadBytes(Convert.ToInt32(br.BaseStream.Length)))
    End Function