Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Storing Image to SQL VarBinary Problem
Message
 
À
20/07/2007 17:28:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01242501
Message ID:
01242509
Vues:
40
cMyImage = 'C:\mypath\myjpg.jpg'
lcfile2 = FILETOSTR(cMyImage)
CREATE CURSOR crsTest (Fld1 M NOCPTRANS)
INSERT INTO crsTest VALUES (lcfile2)
TEXT TO lcSQL NOSHOW PRETEXT 15 TEXTMERGE
    INSERT INTO MySQLTable (MyKeyField, MyStatus, MyLastName, MyImage)
                    VALUES (5,'A','Jones',CONVERT(varbinary(max),?crsTest.Fld1))
ENDTEXT
IF sqlexec(6,lcSql) < 0 && Hmmm 6? HA
   AERROR(laError)
   MessageBox(laError[1,2])
ENDIF
This also works:
cMyImage = GETFILE()
lcfile2 = FILETOSTR(cMyImage)
TEXT TO lcSQL NOSHOW PRETEXT 15 TEXTMERGE
    INSERT INTO TestMe (MyTest)
                    VALUES (CONVERT(varbinary(max),<<0hlcfile2>>))
ENDTEXT
IF sqlexec(6,lcSql) < 0 && Hmmm 6? HA
   AERROR(laError)
   MessageBox(laError[1,2])
ENDIF
But I am not sure what you will get back :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform