dchau Level: Trainee
 Registered: 22-07-2005 Posts: 1
|
Display picture by using VB6, CR and MySQL
hi all,
i'm using VB6, CR8.5 and MySql 4.0.18. what i'm trying to do is to display a BLOB field in mysql as an image in CR. I'm using active data (.ttx) to define the DB of CR. and passing a recordset to CR to display.
the image will be stored into db right before the report starts, and a recordset will retrieve the blob field again and pass it to the report.
please see my coding below,
SavePicture Picture1.Image, "c:\tempsign.bmp"
Set rsStore = New ADODB.Recordset
rsStore.Open "Select * from signature where 1=0", cn, adOpenKeyset, adLockOptimistic
'load pic file to stream
Set mstream = New ADODB.Stream
mstream.Type = adTypeBinary
mstream.Open
mstream.LoadFromFile "c:\tempsign.bmp"
rsStore.AddNew
rsStore.Fields("JobID").Value = m_lngJobNo
rsStore.Fields("Signature").Value = mstream.Read
rsStore.Update
rsStore.Close
mstream.Close
strSQL = "Select * from signature Where JobID = " & Val(m_lngJobNo)
rsSign.Open strSQL, cn, adOpenKeyset, adLockOptimistic
Report "\rptJobSignature.rpt", IIf(frmPrintDialog.m_strDest = "Printer", True, False), frmPrintDialog.cboPrinters.ListIndex, False, False, , rsSign
the report function is a function which will pass all the data to CR.
my problem is, the image has been displayed, but in corrupted appearance. i can see part of the image correctly, but not the complete one. (please refer to the attachments)
please help.
____________________________ Attached:
corrupted.zip 3 KB (Downloads: 2)
|