Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Storing Image to SQL VarBinary Problem
Message
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:
01518429
Views:
84
>>OK, I'm feeling pretty silly :o) Thanks again Borislav!
>
>Aren't we all in Friday?
>
>BTW that works for me better:
>
>cMyImage = GETFILE()
>CREATE CURSOR crsTest (Fld1 BLOB)
>INSERT INTO crsTest VALUES (FILETOSTR(cMyImage))
>TEXT TO lcSQL NOSHOW PRETEXT 15 TEXTMERGE
>    INSERT INTO TestMe (Mytest)
>                    VALUES (?crsTest.Fld1)
>ENDTEXT
>IF sqlexec(m1,lcSql) < 0
>   AERROR(laError)
>   MessageBox(laError[1,2])
>ENDIF
>
>
>CLOSE DATABASES ALL
>SET VARCHARMAPPING ON 
>CURSORSETPROP("MapBinary", .t., 0)
>TEXT TO lcSQL NOSHOW PRETEXT 15 TEXTMERGE
>     SELECT * FROM TestMe
>ENDTEXT
>IF sqlexec(m1,lcSql,[aaa]) < 0
>   AERROR(laError)
>   MessageBox(laError[1,2])
>ENDIF
>BROWSE NORMAL
>
>where m1 is my connection handler to SQL Server
>TestMe.Mytest is a varbinary(MAX) field

So, you're storing varbinary(max) field in SQL Server and retrieve with simple SELECT ... by using two extra commands right before, correct?

And then how exactly you're showing this field and updating? We're retrieving the data with SQL Pass Through, but by setting several properties we're manipulating with the record as as in a remote view.

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform