Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a StrToHex API function?
Message
From
05/02/2002 04:03:31
 
 
To
05/02/2002 00:32:25
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00614674
Message ID:
00615270
Views:
37
Thanks Xavier.

>Hi Daniel,
>
>You can also have a look at the cryptapi in the classes shipped with foxpro,
>
>it encrypt string, files etc... I have used cryptor and the classe and they both work very well, I found the classe has got more to offer.
>
>Cheers
>
>Xavier
>
>>This is a follow-up on Vlad's FAQ#7995 regarding the difficulties to update SQL Server image fields with binary data when using SPT. So far I've been using the workaround suggested in the FAQ. The workaround is quite involved and requires an extra copy to disk. Last week I was looking into this problem again as I thought that there must be an easier way to do this.
>>
>>I used the SQL Profiler and found that binary data is actually sent in HEX format. For example, the string "Hello World" is sent as 0x48656C6C6F20576F726C64. I then created a simple program that converts a string into HEX format. This allows me to insert binary data into SQL Server with the following syntax:
>>
>>?SQLEXEC(nSql, "UPDATE MyTable SET ImageField = " + StrToHex(FILETOSTR(MyBinaryFile)) + " WHERE PkField=1")
>>
>>
>>This works well and the same approach could also be used to send binary data to a stored procedure. The problem is speed. My function StrToHex() loops through the file character by character. Needless to say that this is very slow. Does anyone know of an API/FLL function that converts a string into HEX? The funny thing is that VFP internally does exactly this when using SPT or a remote view.
>>
>>TIA
Daniel
Previous
Reply
Map
View

Click here to load this message in the networking platform