Question database encryption

developer_mahmoud

Well-known member
Joined
Nov 13, 2010
Messages
64
Programming Experience
1-3
hi every body
1- if i have aform with 5 textboxes for example connected to data base how can i encrypt it to save it in the database and how can i decrypt it when i call it from the data base ?
2- if i have many sql queries like sum insert avreage with conditions how can i make it with the encrypted data?
thank u and i need help
 
i will test it again
my second question i have afield called item name and i work with dataset and i have afunction called decrypt so to decrypt that field in ther datagridview first i will show the gridview then i will use this code
[decrypt(datagridview1.columns(itemname)]
is it right?

No it isn't right. As we have said more than once, you get the data, then you decrypt it, then you display it. You populate a DataTable, you loop through that DataTable to decrypt each row, then you bind the data to the grid.
 
cmd = ("select itemname from item ")

DS.Clear()

CON.Open()
Dim DataAdapter1 As New OleDbDataAdapter(cmd, CON)
Dim dt As DataTable
DataAdapter1.Fill(DS, "dt")

Dim row As DataRow
For Each row In dt.Rows
Dim x As String
x = row("itemname")
x = decrypt(x)
Next row
CON.Close()
DataGridView1.DataSource = DS
DataGridView1.DataMember = "dt"
imake it like this but it doesnt work
 
In your loop, you are getting the data from the DataRow and assigning it to 'x'. You then decrypt the data stored in 'x' and assign the result back to 'x'. You then don't actually do anything with 'x'. You simply discard the decrypted result and go ahead and bind your DataTable, which still contains the original encrypted data. If you want to display the decrypted data then you have to display the decrypted data.
 
Back
Top