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?
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
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
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