Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Blob Datatype (getting image from SQL)...
Message
From
05/10/2007 15:24:32
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Blob Datatype (getting image from SQL)...
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01259045
Message ID:
01259045
Views:
70
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).
Marc Levesque
La Prairie, Quebec (CANADA)
marc.levesque@videotron.ca
Next
Reply
Map
View

Click here to load this message in the networking platform