Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert Binary to String for SQL Update
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01524435
Message ID:
01524459
Vues:
51
My solution was to write a simple NumToHexString function and loop through the binary to build the lcPersonID string.
  lcPersonID = ""
  FOR i = 1 TO 10
    lcPersonID = lcPersonID + NumToHexStr(ASC(SUBSTR(PersonID,i,1)))
  NEXT 


*-- NumToHexStr--*
LPARAMETERS num
LOCAL nh, nl, sh, sl

If num < 0 or num > 255
  RETURN  "??"
ENDIF 

nh = INT(num / 16)
nl = MOD(num, 16)

sh = IIF(nh < 10, chr(48 + nh), chr(55 + nh))
sl = IIF(nl < 10, chr(48 + nl), chr(55 + nl))

RETURN sh + sl
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform