Link to home
Start Free TrialLog in
Avatar of Nitin Shah
Nitin ShahFlag for India

asked on

how to print picture in vb - crystal report dsr from table

i want to print picture from file whose file name is stored in sql table. i want to each employee foto in vb application using crystal report DSR. how can i print foto in report?
Avatar of Mike McCracken
Mike McCracken

What version of Crystal?

mlmcc
Avatar of Nitin Shah

ASKER

crystal 8.5, vb6
Create your report
add an image - any image if you wish
Right click on image
select Format Graphic
Click on Picture Tab
You should see a Formula Button for the Graphic Location
Place your database field here which should hold the Path for where the picture resides.
dear brook1966

i want to print it from file whose location is stored in sql table. i want to print it dynamically. this will not work in dsr mode when i want to print picture runtime from employee table.

thanks  
You need Crystal XI to do that.  Earlier versions require the image to be stored in the database.

mlmcc
dear mlmcc

i will try and revert back

thanks



dear mlmcc

i think it take more time to get crystal xi. can u tell me how to store picture in database and print it runtime in crystal 8.5 version?

thanks



I don't know how to store a picture in a database.  Some databases have a image or binary datatype.

mlmcc
I have seen that you can save some pictures in binary format and save them in the database in a big integer field.  SQL Anywhere has this type of field.  What database are you using?
dear brook1966

i am using ms sql database
is anybody can help me out ?
I am looking into storing the picture as a binary data type....
storing is not the problem - making sure you can extract it in a crystal report is the question.
It has to he stored as an image.  many databases have a BLOB type that can be used.

mlmcc
ms sql does not have data type as BLOB

nitin shah
 
Older versions of SQL Server had an Image data type.
Does yours?

if it does - you can open your file with a stream and save it to your sql server that way.
then crystal will report with the image data field...

I was able to write an image to a Binary data type but could not find a way to show this back as an image in Crystal 8.5
sql 2000 has data type as image . but how to store jpg or other picture file in database
ASKER CERTIFIED SOLUTION
Avatar of Brook Braswell
Brook Braswell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
dear brook1966

i am able to store image but not able to print it

i can see picture in vb data screen correctly


 




So you just place the image field in the report like any other field and the picture does not show?....
I tested this with XI and with 2008, I have not tested with 8.5 but remembered that it is supposed to work there also.
My only other thoughts would then be that you may look into upgrading your CR to at least XI
have you tried creating a report from scratch with the crystal designer - before importing into your app as a dsr?
dear brook1966


thanks for your kind help. i am able to store picture in sql database as per your coding. i am storing picture as well as file location in database. i am able to print in crystal dsr mode.

i accept this as solution to my problem, but can i print picture from file location define in database.

with regards

nitin shah

Crystal 8.5 will not allow you to print from a file location.

I have crystal XI and 2008.  Both have an option on image objects that allow a path to be given and have the image refresh on print.  Here is where I normally put the field in the database containing the file location.  "WARNING" make sure the path in the database is available to users of the report.
Best Practice is to NOT put drive letter designation but rather the UNC path.
NOT D:\SharedPath\Picturename.jpg
DO \\ServerName\SharedPath\Picturename.jpg


Happy Coding :)
dear brook1966

thanks for help.