I know two ways to store a file into sql table. First is to use in vfp a general field like this...
>create cursor curTMP (document general)
append blank
append general from getfile()
>and the second way is the following...
create cursor curTMP (document blob)
lcStr = FILETOSTR(getfile())
insert into curTMP (document) values (lcStr)
>and finally in both cases complete with...
h=sqlconnect(...)
=sqlexec(h, "insert into MySqlTable (Id, Document) values (newid(), ?curTMP.document)")
That works fine!
The problem is when I want to extract the document down to VFP. Then I do the following...
=sqlexec(h, "select * from MySqlTable", "curSQL")
=STRTOFILE(curSQL.document, "c:\MyFileFromSQL")
I got the following error message...
"OLE object is invalid or corrupted"
What's wrong?
Also in second case, the TYPE('curSQL.document') return GENERAL (not BLOB).