?
Solved

Database Image object causes Crystal Report to be blank.  I need to show Images Dynamically.  How can I fix this?

Posted on 2007-07-24
32
Medium Priority
?
649 Views
Last Modified: 2013-11-26
 I am using Visual Studio 2005.  I am using Crystal Reports with MS SQL Express.  I have a table in my database/dataset with a column of type "Image".  When I drop the "Image" field onto my Crystal Report and run it, all fields and subreports are blank (as well as the image field).  If I remove the field, all other fields and subreports show up fine.

  I have created a test form that simply injects an image into the database and shows the image from the database on the form.  This shows that I am injecting the image properly and that the image does exist inside of the database.  I am also sure that I have my tables linked properly via primary and foreign keys within my Crystal Report.

  My goal is to show images dynamically on the report.  From my research, passing the images through the database is the only way to do this with Crystal Reports inside of Visual Studio.
0
Comment
Question by:bb3177
  • 14
  • 10
  • 6
  • +2
32 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 19557815
Could be the format of the image.  Check this article out - it's for CR8 but it may still apply:  http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2006485&sliceId=&dialogID=4620865&stateId=1%200%204618760

If that doesn't help, what format is the image stored in?  If possible try a generic format like .bmp for a test and see if it works - that will isolate whether it's an image format problem or something else.

frodoman
0
 

Author Comment

by:bb3177
ID: 19557924
 I have tried both bmp and jpg files.  They show up if I drop it from the database onto a Form.  However, Crystal Reports shows up blank (all fields and subreports) when I drop it from the database onto the report.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 19558086
I assume that you aren't doing any comparison or filtering to this field?  
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:bb3177
ID: 19558681
Correct.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 19558744
Sorry, I have no idea but I'll see if I can get another expert to take a look at it...

0
 
LVL 13

Expert Comment

by:crgary_tx
ID: 19559200
I think the images can be dynamically added with the path stored as the d/b location only from Crystal XI onwards.

Gary
0
 
LVL 42

Expert Comment

by:frodoman
ID: 19559232
That is correct - he's actually storing the image in the database.  I've done this many times coming from an Oracle BLOB field but never from a SQL Image field... - frodoman
0
 
LVL 35

Expert Comment

by:James0628
ID: 19559351
> They show up if I drop it from the database onto a Form.

 By "Form" do you mean a Crystal Reports report or something else?  Just checking.  If you do mean something else, what happens if you create a new CR report and try to show the image there?

 James
0
 

Author Comment

by:bb3177
ID: 19559663
The Form that I am referring to is a standard windows form.  I can drop an image field from a dataset onto a windows form and it shows up fine.  When I drop it onto a crystal report, all other fields go blank.

I just created a new project with the same dataset and the same database.  I have created a windows form with the image dropped on from the database as well as a crystal report with the image dropped on from the database.  The image shows up fine on the windows form.  On this new project, the image still does not show up on a crystal report, but the other fields are not going blank.
0
 

Author Comment

by:bb3177
ID: 19559859
Correction, the fields in the report are still blank in the new test project as well (It was the print date showing up; that is not from the database).
0
 

Author Comment

by:bb3177
ID: 19559990
 I have added another column to my image table.  It is a numeric.  Adding this field to the report has the same effect as adding an image.  When I add the numeric field to the report, it causes all other fields and subreports to go blank.  This means it is not an image problem as I thought.  Any suggestions?

  This same results are achieved in my seperate test project.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 19560154
Are all of these fields in the same table or does the problem occur when you add a field from a different table?  If that's the case it could be a linking issue.  Even though you specify data tables and links, Crystal doesn't always enforce them in the sql until you use one of the fields from a table in your report...
0
 

Author Comment

by:bb3177
ID: 19560393
Fields form other tables work fine (there may be 1 or 2 others with the same issue).  I have about 15 or so tables.  I have checked the link for this table and it is the right.
0
 
LVL 7

Assisted Solution

by:ast2550
ast2550 earned 900 total points
ID: 19560477
It sounds like it is a table linking issue.

Suggestions:
1) Work backwards, add only the image table.  If it works add tables until it doesn't work
2) Copy the SQL to SQL Query analyzer and see if you can ge the numeric value to appear in the results.
0
 

Author Comment

by:bb3177
ID: 19567500
I have now gone as far as to convert my database to Access.  I now use a oleObject field in place of the Image field.

The same thing happens in my Crystal Report (Any field from a table with an image/ole field causes the report to be blank).  I am starting to think that Crystal Report cannot handle any returned query with binary data?  Perhaps there is a bug in this version?  If not... there must be something that I am doing wrong in relation to my Crystal Report and Binary Data.  Keep in mind... this same binary data displays fine on other display formats, just not Crystal Reports.  Any suggestions?
0
 
LVL 42

Accepted Solution

by:
frodoman earned 600 total points
ID: 19568150
What format is the image in?  Crystal only supports specific formats, particularly the version embedded with Visual Studio.  Here's the list I found on BizObj site:

Crystal Reports reads the following SQL BLOB formats:
· TIFF
· BMP
· JPEG
· PNG

Crystal Reports does not support:
· GIF
· TIFF files that use LZW compression
· WMF

frodoman
0
 
LVL 42

Expert Comment

by:frodoman
ID: 19568175
Also, does the report show the image correctly on the development environment but not when deployed or does it not work correctly at all?
0
 
LVL 7

Expert Comment

by:ast2550
ID: 19568530
Have you tried creating a report with just the one image table?

you said, "Adding this field to the report has the same effect as adding an image."  This response makes me think that it is not an image issue.
0
 

Author Comment

by:bb3177
ID: 19569288
The Image formats I have tried are jpg and bmp.  I have one field that is a number, and 4 fields that are images.  Adding any of these 5 fields causes the rest of the report to go blank.  However, I have tried creating a new table with these same fields and have even switched databases.  This was to make sure it was not the way I defined my data and that my links were built properly.  It may not have anything to do with the images, but I am lead to think that it does because the only tables not working are ones with images.  Perhaps there is something special I must do for image fields to work with Crystal Reports?
0
 
LVL 42

Expert Comment

by:frodoman
ID: 19569387
Nothing special you should need to do.  You can rt-click on the field in your report and select format.  Make sure on the Picture tab you have the size and scaling set appropriately and that you have the crop values all set to zero - all of this should be the default unless you've already changed some of these properties.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 19569394
When you're testing by dropping the image onto a form, are you using the same database driver that you're using in Crystal?  I assume so but want to eliminate the possibility that you're using a driver that can't handle the binary data correctly...
0
 
LVL 7

Expert Comment

by:ast2550
ID: 19569403
Please create a new report and add only one table, the table with the images.  Then, if you can get the images to show up or if they don't we'll know more.
0
 

Author Comment

by:bb3177
ID: 19569613
yes, I am using the same database and dataset on the windows form and the crystal report.

I just created a brand new project.  I have deleted every table from the database and created one new table.  I have one int field and one image field.  If I drop either onto the report, the report shows no data from the database.  This is starting to look more and more like something is wrong with Crystal Reports?
0
 
LVL 7

Expert Comment

by:ast2550
ID: 19569835
Wait a minute, didn't you used to have a fully functional report that just need one more table added?

So, now you cannot even get a new table with an integer column to show data in a new report?
0
 

Author Comment

by:bb3177
ID: 19570152
Crystal Reports are a Nightmare...  I have had nothing but trouble with it since this project started.  Is there any equivalent out there?  I looked at the Visual Studio reports, but that would not let me show individual fields... only sums and averages and such.

Ok... I think I am having an unrelated (perhaps related) issue with the new project I just made.  I created a database with a number and manually insert a new row with some number in it (done in the code).  I drop that field onto crystal report and the thing comes out blank.  I verified that the new row exists in the database and it does.  Makes no sense.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 19573759
>>> I looked at the Visual Studio reports, but that would not let me show individual fields... only sums and averages and such.

Sounds like you're dragging fields directly onto the report which creates a summary automatically.  Try dragging a table onto your report, then drag the fiels onto the table to get the individual values...

0
 
LVL 7

Expert Comment

by:ast2550
ID: 19574654
Crystal doesn't behave this badly.  There is something else wrong.  I never use the crystal that is embedded with VS2005, but many others do regularly...It just works.  I could understand that there are issues with streaming images out of a database, but getting an integer into a report is the simplest thing ever...It never causes problems nor is tricky.

"manually insert a new row "  The new row, is it the only table in the report?  Or, are there multiple tables?  Because if there are multiple tables, usually a blank report is caused by an improper join.

If there are multiple tables, recreate the query you are creating in crystal in your SQL Server.  You can then see what dataset is being passed to crystal.
0
 
LVL 7

Assisted Solution

by:ast2550
ast2550 earned 900 total points
ID: 19574872
I'm getting the feeling that there are intermitant or sporadic failures, but that we aren't getting the wide view of what is going on.

So, let's get some foundation for what you think you can get to work.

1) Are you having problems with one particular table or all tables that you create and/or have created?
2) Can you create a report that accesses some data?  (I think at one point you had a report with 15 tables, right?)
3) Can you create a report that utilizes multiple tables (two or more tables that are joined)?
4) Have you gotten any report to display images from your database?
0
 

Author Comment

by:bb3177
ID: 19574974
At this point I have 2 projects going.  The first is my main project.  It is the one that has 15 or so tables.  Only one of those 15 has images in them.  It is the only table giving me problems right now.  My second project is a test project that I created to try to recreate some of these issues.  At this point in time, that project has a database with 1 table and 1 column of type int.  On this project, I can't even get crystal report to display the field for that integer.  I have not been able to get an image to show on a crystal report from the database on either project.
0
 

Author Comment

by:bb3177
ID: 19575105
 Is there somewhere that I can send my test project to for you to look at?  It has 1 .mdf database with 1 table with 1 column (int).  It has 1 form with a crystal report viewer which is attached to a crystal report and I also have a binding naviagotor set up so I can see the data being accessed during runtime.  There is one dataset linked to the database.  Finally, there is one table from the dataset linked to crystal report and there is one field dropped onto the report.
0
 

Author Comment

by:bb3177
ID: 19575178
I tried to drag a table onto a visual studio report from both the Server Explorer and the data source... Neither allow me to drop a table.  From the Server Explorer, it acts like it lets me drop a table or a field but nothing actually changes.  From a Data Source, I get the circle with the slash when I try to drop a table, but it does allow me to drop a field, which shows up as a sum.
0
 

Author Comment

by:bb3177
ID: 19576082
 Got it figured out!  Ok... so with my crystal report, I set the datasource like this:

crystalReport1.setDataSourse(myDataSourceInstance);

  Right before that, I do a fill on every table via each table's table adapter like so:

table1TableAdapter.Fill(myDataSourceInstance.Table1);

  The problem was that when I added my new images table, I totally forgot about populating my dataset.  I just needed to fill the table before I passed the dataset to the report and VOILA!

Thanks so much for your help guys.  I would have given up on this long ago without your help.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Screencast - Getting to Know the Pipeline
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question