Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Image field insert problem
Message
From
17/01/2003 08:35:04
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00741872
Message ID:
00742823
Views:
11
Charlie,

Yes (If I understand what you're referring to) - Using the FoxCrypto fll, I wrote "StrToHex()" and "FiletoHex()" functions that work very well and fast. I can then use regular SPT to insert or update to SQL Server. We just include the fll right in our exe - works fine. A couple notes:

1 - We sometimes had problems with the combination of ?Myfield for regular fields and the straight StrToHex() in the same statement. VFP or ODBC or something seems to make decisions about how to send up a statement based on some algorithm that we haven't had time to decipher completely. Our best working solution was to either concatenate the entire SQL statement (i.e. no "?" used at all) or to only use ? for the non image fields and use a separate statement for the image field.

2 - I wrote wrappers around Vlad G's idea (bit flipping a column) for moving binary data in and out of VFP general fields. They are GFieldToFile(), GFieldToString(), and FileToGField() - these are working very well. Note that I have had no problem doing a tableupdate() when UPDATEing from an updatable VFP cursor - my problems were with INSERTing via tableupdate() - so basically, my data object checks for inserts, conacatenates a SQL string for the INSERT using the StrToHex(GfieldToString()) to get the data from the cursor into the hex that the SPT needs. It's all working well right now - and we're pushing not only .doc files, but large exe's and zip files up and down.

3 - A final puzzle was how to get this to work in XML using CusorToXML and XMLToCursor. The secret turned out to be using Memo(binary) fields in VFP and the right flags on the functions. We discovered that you can "Select Convert(binary, '') as MyMemoBinField" from SQL server and it gives you a memo binary in VFP. We then just push the data from the general field to the memo binary using GfieldToString(). After that the XML functions send it across beautifully.

HTH,
Ken

>Ken:
>
>I have been watching this thread becuase I'm gonna need to do the same thing. I'll be storing Words docs in Image field using SPT. Does the solution at end of article work?
>
>Thanx,
>Charlie
Ken B. Matson
GCom2 Solutions
Previous
Reply
Map
View

Click here to load this message in the networking platform