Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Storing Image to SQL VarBinary Problem
Message
 
To
20/07/2007 18:05:23
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01242501
Message ID:
01242520
Views:
54
This message has been marked as the solution to the initial question of the thread.
>Using:
>
>lcFile = FILETOSTR(GETFILE())  && I just grab any smallsize bmp
>clear
>CREATE TABLE mytable1 (c1 I, c2 c(1), c3 c(10), c4 M NOCPTRANS)
>CURSORSETPROP("MapBinary",.T.,0)
>APPEND BLANK
>REPLACE c1 WITH 4, c2 WITH '', c3 WITH 'Anderson', c4 WITH lcfile
>TEXT TO lcSQL NOSHOW PRETEXT 15 TEXTMERGE
>   INSERT INTO TestImportCase (TestKey, Status, LastName, cImage) VALUES (<<mytable1.c1>>,<<mytable1.c2>>, <<mytable1.c3>>,CONVERT(varbinary(max),mytable1.c4))
>ENDTEXT
>IF SQLEXEC(6,lcsql) < 0
>   AERROR(laERROR)
>   MESSAGEBOX(laError(1,2))
>ENDIF
>
>Returns: " Incorrect syntax near ',' "
Tracy,

It is obviously a Friday :-)
the syntax should be:
TEXT TO lcSQL NOSHOW PRETEXT 15 TEXTMERGE
   INSERT INTO TestImportCase (TestKey, Status, LastName, cImage) VALUES
                              (<<mytable1.c1>>,'<<mytable1.c2>>', '<mytable1.c3>>',
                              CONVERT(varbinary(max),?mytable1.c4))
ENDTEXT
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform