Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Blob Datatype (getting image from SQL)...
Message
De
05/10/2007 15:24:32
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Blob Datatype (getting image from SQL)...
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
MS SQL Server
Divers
Thread ID:
01259045
Message ID:
01259045
Vues:
69
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform