Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Character 0 and sqlexec
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01372936
Message ID:
01372957
Views:
17
This message has been marked as the solution to the initial question of the thread.
>I'm storing a credit card number to SQL Server and have a "best method" question. What is the best way to store encrypted data in SQL Server? I'm using Craig Boyds VFPEncryption.fll to encrypt strings prior to storing them to a database. As part of the encryption sometimes characters in the middle of the encrypted text will be chr(0). SQL Server doesn like this:
>
>SQLEXEC(pnHandle,[update payments set ccnumber='123]+chr(0)+[123' where pk=1])
>
>Will result in error:
>Connectivity error: [Microsoft][SQL Server Native Client 10.0][SQL Server]Unclosed quotation mark after the character sring '123'
>
>
>What is the best way to do this?

Use a binary field not a (n/var)CHAR one, and use parameter when you send the CC number:
lcCC = CRYPT(.....)
SQLEXEC(pnHandle,[update payments set ccnumber=?m.lcCC where pk=1])
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform