Skip to Content
avatar image
Former Member

Images in Crystal Reports 8

I am using Crystal Reports 8 for reports and wish to stay with that version, as upgrading would effect many clients and have a significant overhead. What I am trying to do is have an image in a report file, and have the file name and path of the image be stored in a table. This way i can make the image dynamically change based on what part of the report I am in. If anyone knows a way to do this, please let me know. Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 23, 2008 at 08:16 PM

    Hi Greg,

    Yes we can insert Images into a Database for use with Crystal Reports.

    The SQL Server Image data type is capable of containing image data. Image data is inserted into Image fields through the use of a Microsoft utility called BCP. BCP is a command line application that is installed as part of the SQL Server client installation.

    In SQL Server, complete the following steps to create a table with an Image field and to insert image data into this field.

    1. Create a table and define a field as Image data type.

    Syntax of command line:

    CREATE TABLE yourtablename (yourfieldname image)

    2. Using the BCP utility, enter the command line syntax as shown below. To insert image data, the syntax has been streamlined.

    C:\> BCP <database>.<owner>.<table_name> in <path>\<filename> -S<server_name> -U<username> -P<password>

    Where:

    <database> is the SQL Server database referenced,

    <owner> is the owner of the table,

    <table_name> is the name of the table,

    <path> is the fully qualified folder that the image file resides in,

    <filename> is the name of the image file, with extension,

    <server_name> is the name of the SQL server,

    <username> is the name of a valid user with INSERT rights on the table,

    <password> is the useru2019s password.

    For example:

    C:\> BCP Techtest.vantech.ImageTable in C:\Images\Xtreme.jpg u2013Sdbconn1 u2013Uvantech u2013Pvantech

    When running the BCP utility, you will be prompted for several parameter values.

    1. Hit ENTER for the file storage type prompt.

    2. Enter 0 for the prefix-length prompt.

    3. Enter the length (size) of image file in bytes for the length of field prompt.

    4. Hit ENTER for field terminator prompt.

    5. Enter n for save format information prompt.

    Crystal Reports 8 and later can now report off image data that has been inserted into the SQL Server Image field

    Which is the database that you are using?

    Regards,

    Prashant

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 23, 2008 at 08:22 PM

    Hi Greg,

    Crystal 8 doesn't support dynamic images like you are describing. When an image is linked to a report, the path is hardcoded to the image. Dynamically the RDC has access to that property and you can change the path and filename from a front-end application developed in VB or something but not from the report designer.

    The best way to do this would be to import the image into your database and drop that field onto the report. There is a reduction in picture quality but it works nicely. The sample database Xtreme.MDB has a sample image in it.

    Good luck,

    Brian

    Add comment
    10|10000 characters needed characters exceeded