cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying image in crystal reports

Former Member
0 Kudos
66

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.

regards,

sunitha

Accepted Solutions (1)

Accepted Solutions (1)

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

Regards,

Shweta

Answers (2)

Answers (2)

Former Member
0 Kudos

Yes,only a formula can solve this,but the problem is that there is no way to find x co-ordinates of a field in crystal report associated with VS2005 or crystal report 9.0.

Do you have any idea how to achieve this?

Former Member
0 Kudos

I linked a sample report to the master table that stores the logo(only 1 row exists for this table,but logo can be null or get updated from time to time),dragged the blob firld to the report(it asked for a link between the current stored procedure and the master table,which i ignored).The image is now getting displayed and i am able to suppress theield when null.I dont know whether this is the right method.

I also want to know whether you can set the position of another field based on whether the image is null or not.

thanks in advance...

Former Member
0 Kudos

Hi Sunitha,

I think to set the position of another field based on whether the image is null or not you need to create formula.

Regards,

Shweta