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

房东的猫 提交于 2021-02-08 10:25:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!