I'm having an issue getting a Database bound image to display in a SSRS 2008 R2 report. Any idea why it won't display the image in Method #1 below?
The report prompts for a logo to be selected by user displaying a list of logos bound to a report parameter called LogoID. LogoID parameter is bound to the following list where Value field = LogoID and Label field = LogoName. Table def below:
dsLogoList definition:
LogoID int
LogoName varchar(25)
ImageData varbinary(max)
ContentType varchar(25)
Method 1: THIS DOES NOT WORK:
I use the following Lookup function on the Image control under "Use this field" to set the image value for the Logo:
=Lookup(Parameters!LogoID.Value, Fields!LogoID.Value, Fields!ImageData.Value, "dsLogoList")
Please note the image source = Database and Mime type = "image/gif" (all images are gif in database).
I get no errors but when i run the report in BIDS or after publishing to server the image is not displayed.
Method 2: THIS METHOD WORKS:
I get this to work if i create a second dataset called dsLogoLookup that includes a query param to filter by logoID:
select LogoID, ImageData from tblLogos where LogoID = @LogoID
Then i bind Image control using the following expression:
=First(Fields!ImageData.Value, "dsLogoLookup")