问题
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!!
回答1:
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
来源:https://stackoverflow.com/questions/16454561/how-to-display-an-image-from-a-sql-query-that-gives-a-file-path-in-ssrs-report