Don't use general fields. For blob see
Re: How to control the contents of a Pass-through query Message #
1251009.
Also you can add file to blob with APPEND MEMO
create cursor curTMP (document blob)
append blank
append memo document from getfile()
>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).
--sb--