Search code examples
crystal-reportscrystal-reports-10

Crystal Reports : Insert an image in the Report Header section


I need to insert a report homepage on an existing RPT file. The existing RPT file works fine, it displays results from a stored procedure. It's ok.

The homepage must contain an image from the database. So first, I added a new SQL command (through the window "Database Expert") with a new SQL query in order to get the image logo. I drag & drop the image field in the Report Header section. It works in the designer, I can see the image which is retrieved from the database.

But when I generate the report, my SQL query which get the image is executed several times... I can see it in my SQL profiler... I think that my query is executed FOR EACH row which is returned by the initial stored procedure... I don't know why.

Version of Crystal Reports : 10.2

Any ideas ? Thanks a lot.


Solution

  • I finally found the following solution :

    1 > Create a new SubReport. (Right click on the designer > Insert > SubReport). This new SubReport will be related to the table which contain the image data.

    2 > Ensure that this sub report is in the Report Header section. Remove black borders if needed.

    3 > In the SubReport, drag your image SQL field into the Details section. Don't forget to specify an equals-condition in order to retrieve the right image.