Results 1 to 3 of 3

Thread: Showing Pictures in Crystal Reports

  1. #1
    Join Date
    Dec 2004
    Posts
    159
    Rep Power
    0

    Default Showing Pictures in Crystal Reports

    I have a crystal report that gets its information from a database including the picture location. How can I show that picture in the crystal report or what should I uses to show that picture from the path in the report?
    Last edited by samuelmitch; Apr 30, 2007 at 03:29 PM. Reason: incorrect wording
    live good today cause u will never know wat will happen 2marrow and it was never promised to no man either

  2. #2
    Join Date
    Dec 2002
    Posts
    500
    Rep Power
    0

    Default

    i dont know how to tell crystal report to load an image from a location...

    but the last time i made a crystal report show an image it was from an image database field. if the field is an image datatype crystal report will show it as an image.

    since that isnot how you have ur database heres a go round...

    create a typed dataset for the table from the database (drag the table from server explorer into a xsd (dataset) file )
    add an image as a field in it
    make the report using that dataset
    at runtime load the dataset with data from the database
    loop through the datatable and load the image from file into the datarow
    set the dataset as the datasource for the report..
    Cultured in Aggression and Koding like a Warrior!!
    “Common sense is instinct. Enough of it is genius.” - George Bernard Shaw.
    "The significant problems we face cannot be solved by the same level of thinking that created them." - Albert Einstein

  3. #3
    Join Date
    Dec 2004
    Posts
    159
    Rep Power
    0

    Default

    My Solution
    -----------
    I create a work around. this is what I did:
    I added another field with image type and then place that picture field on the crystal report. In adding/updating the picture, I let it add the picture or set it to null using the following code:

    'I assign the picture path to MemberPicture variable previously from the file open dialog box
    ------------------------
    If MemberPicture = "" Then
    .Parameters("@Photo").Value = DBNull.Value
    .Parameters("@Picture").Value = DBNull.Value
    Else
    .Parameters("@Photo").Value = MemberPicture
    Try
    Dim fs As FileStream = New FileStream(MemberPicture, FileMode.Open, _
    FileAccess.Read)
    Dim img As Byte() = New Byte(fs.Length) {}
    fs.Read(img, 0, fs.Length)
    fs.Close()
    .Parameters("@Picture").Value = img
    Catch ex As Exception
    MessageBox.Show("Unable to save picture because " + ex.Message)
    .Parameters("@Photo").Value = DBNull.Value
    .Parameters("@Picture").Value = DBNull.Value
    End Try
    End If
    live good today cause u will never know wat will happen 2marrow and it was never promised to no man either

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •