Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a StrToHex API function?
Message
De
04/02/2002 05:03:12
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Is there a StrToHex API function?
Divers
Thread ID:
00614674
Message ID:
00614674
Vues:
102
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform