Skip to Content
0
Former Member
Apr 25, 2017 at 02:29 PM

Unable to load image from database OR path unto a crystal report

2014 Views Last edit Apr 25, 2017 at 10:39 PM 2 rev

Greetings, I have spent many days attempting to show an image on my crystal report in MVC C# and I have come to the conclusion that that might not be working.

I first attempted to load the image from my database.

This is what I did, and please point out if i'm doing something wrong.

First, I added a logo via insert picture then...

I saved an image as varbinary(max) in a mssql database(so it looks something like this 0x479463839). Then I selected the image, into a data table in C#, changed the data type to system.byte[]. I then created a report based on that data table. Then i drag the image column to the report and it comes up as a blob but when I run the report..nothing shows and I get a CrystalImageHandler Error.

To solve this I added the ignore route to the route

and added the lines below to the webConfg httphandler and handler.

<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>

<code>routes.IgnoreRoute("{*allaspx}",new{ allaspx =@".*(CrystalImageHandler).*"});

Upon doing that, When I ran the report again, the logo image showed up, however the image in my database field still did not show up.

What else I tried

I then attempted to display the image via the path, to accomplish that, I again stored my path in my database via code. Then I added an image (I added a picture with a dummy image and also added a paint box) > Right click>Graphic location and set the location to the database field with the path to the image. However, the image is not display, the same picture is displayed.

I also downloaded and followed this program EXACTLY and it still doesn't work.

http://www.c-sharpcorner.com/uploadfile/4d9083/store-and-retrieve-image-on-crystal-report-from-sql-database/

I would appreciate if anyone could point out where I went wrong and help me correct it or quickly test out a project to verify is "Graphic Location" works. Cause changing my graphic location has no effect on the image.

Regards