Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Functions
Message
 
 
To
09/12/2009 10:32:25
Brad Clark
Delta Express Systems, Inc.
Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01438204
Message ID:
01438211
Views:
65
>I want to replace a field within a table. Basically it is a little encrypt/decrypt function that I have written. Now I want to be able to apply it to a particular field within a table for security reasons.
function UpdateField

local loError, llReturn

llReturn = .t.

try
   use myTable in 0 alias ToEncrypt exclusive && Do we really need to use table exclusive?
catch to loError
   llReturn = .f.
endtry

if m.llReturn
   try

       replace all myField with Encrypt(myField) in ToEncrypt
   catch to loError
      llReturn = .f. && At this point some of fields could be encrypted, some not - perhaps it's better to buffer the table and do tableupdate instead
   endtry
endif

return m.llReturn
Here is a quick sample - you may implement better error handling and also handle this using table in buffered mode...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform