Dealing with Images in VFP 9.0 and MySQL

Hi all,

I've been trying to store and retrieve a image file in a blob field type available in Mysql.

The code for updating..

Code Snippet

mimg="0X"+Strconv(Filetostr(Alltrim(Thisform.text1.Value)),15)

mstr="insert into testimage values (1,?mimg)"

mres=SQLExec(mcon,mstr)

Ifmres<0

=Aerror(merr)

Messagebox(merr[3],0,mapplnhead)

Return

Endif

For retrieving

Code Snippet

mstr="select * from testimage where id = 1"

mres=SQLExec(mcon,mstr,'crresult')

Ifmres<0

=Aerror(merr)

Messagebox(merr[3],0,mapplnhead)

RETURN

ELSE

mimg=CAST(crresult.image as BLOB)

thisform.image1.pictureval=mimg

*!* =STRTOFILE(mimg,"C:\test.jpg")

*!* thisform.image1.Picture="C:\test.jpg"

thisform.Refresh

ENDIF

But the image is not showing up. I don't know where I'm missing it out...Please help me in this regard.

Best regards,

Markish

[3801 byte] By [Markish] at [2008-1-8]