views:

719

answers:

3

I have a header image that needs to be repeated in the header of multiple reports. I am aware that you can add an image to a report and point to a path where the image file reside, like file://C:\path\to\Reports\Images\logo.gif, but that path can and will change when the app is deployed.

I tried using a relative path like (assuming the reports are in the Reports/ folder) Images/logo.gif (or Images\logo.gif), but this just produces a broken image both in the designer and on the actual output. Is my syntax incorrect? If not, is there a way to do something like this?

EDIT: I also know about embedding an image into a report, but then this image would need to be embedded into every report, and if it needed to be changed, it would have to be changed individually in every report.

+1  A: 

Store the path in a variable in your database, and only keep the field name for each image in your table. Put them together when running your app.

So, you'll have a table with images:

record1 otherdata image1.gif
record2 otherdata image2.gif

and another table that has system variables, including

imagepath  c:\path\to\reports\images\
thursdaysgeek
Sorry, I clarified my question. The image is not part of the report data; it's only a logo in the header.
adamjford
Ok, but can't you still store the path in the database? So when the report is regenerated, it will check and use the current instance of the path? However, since I don't use SQL Reporting services, I don't know how that works.
thursdaysgeek
A: 

We have dynamic header logos. We just store the images in the db, its easier this way. The logos are small enough they don't create much of a performance hit.

Image property on the Image control:

=First(Fields!BlobData.Value, "spimGetReportImg")

spimGetReportImg Dataset just calls the Stored Procedure we use to get the right image. IE:

CREATE PROCEDURE [dbo].[spimGetReportImg]
@pk
AS 
BEGIN
SET NOCOUNT ON
SELECT b.BlobData
FROM   dbo.tblBlob b
WHERE  pkBlob = @pk
Dustin Brooks
A: 

What we ended up doing was described in this blog post. We decided it was Good Enough of a solution, even if the path is, for now, hard-coded in there.

adamjford