JackReacher
JackReacher

Reputation: 465

How to display an image from a SQL query that gives a file path in SSRS Report?

I am working on a report, which I would like to display an image in my database from a query with a parameter. For example:

SELECT pictureATTACHMENT
FROM   myDatabase.dbo.ATTACHMENT
WHERE  DESCRIPTION LIKE @thisCampaign + '%'

My query returns a file path to the image: For example:

\\DASERVER\FOLDER\FOLDER\Data\Attachment\filename.png

How do I need to format the expression for the report to display the image?

I have tried doing: =file:\\DASERVER\FOLDER\FOLDER\Data\Attachment\filename.png

But no luck.

Many thanks in advance!!

Upvotes: 0

Views: 11820

Answers (1)

praveen
praveen

Reputation: 12271

You should store the image in the database as Image data type not as varchar and more over SSRS should have permission to access the image .

Try this without = and in the image property dialogue box select the image source as External :-

 file:///<Location>\Image1.png

With the field from the dataset this can be done using the below expression again selecting the source as External

 ="file:///"+ Fields!pictureATTACHMENT.Value

If you are storing it as blob data then instead of external chose the property Database from the dropdown menu. Select the pictureATTACHMENT field from your dataset and MiME type as png

Upvotes: 4

Related Questions