Data encryption

databases , db Sri Lanka
  • 9 years ago

    Hi guys, I am in need to encrypt my data when they are written to a database and to decrypt them when read. Can some one please shed some light in to this situation. Lets say we use the below statement to insert data. cn1.execute

    "INSERT INTO client_details(name,address) VALUES('" & cus_name & "','" & addy & "')"

    If i was to encrypt how would the above line look, what do i need to add / change and what should be the line for decrypting. 


    If some one can point me in the right direction it would be appreciated very much.



  • 9 years ago


    You can do this by creating a function {eg. "Public Function Encrypt(details as string) as string }, inside a module or the form itself. Then write the code for the encryption inside this function.. Then, call this function before saving the data into the database...

    like the below on:

    dim name, address as string

    name=Encrypt( "NewName")

    address= Encrypt( "NewAddress")


    "INSERT INTO client_details(name,address) VALUES('" & cus_name & "','" & addy & "')"

    And for decrypting, create another function and type the code for decrypting the data (eg.  Public Function Decrypt(details as string) as string )


    I think this will help you... [:) ]

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perl - The only language that looks the same before and after RSA encryption.” - Keith Bostic