Last post May 31, 2011 11:07 PM by joeyan
May 31, 2011 05:03 AM|joeyan|LINK
Now, I can successfully import a dBase file (.dbf) to sql server by following code:
cmdString += "SELECT xxx into Taaa "
cmdString += "FROM OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver;SourceDB=\\aaa\aaa\aaa\aaa\DATA;SourceType = DBF', "
cmdString += "'SELECT xxx FROM mpaydtl where Fincmonth>=')"
Using connection As New System.Data.SqlClient.SqlConnection(SqlDataSource1.ConnectionString)
Dim command As New System.Data.SqlClient.SqlCommand(cmdString, connection)
Because there are two column contain the staff's identity card number and staff name. I need to encrypt this two column.
I had already using encrypt function called"Simple3DES", but i just use it to encrypt data from textbox such as:
Dim wrapper As New Simple3Des(encrypt_pw)
Dim upload_pwd As String = ConvertDBText(reader("upload_password"))
If upload_pwd <> "" Then
tb_upload_password.Text = wrapper.DecryptData(upload_pwd)
How can I write a function in VB code to encrypt the whole column of the table ? use loop function to read & update for each row ?
May 31, 2011 07:13 AM|mitja.GTI|LINK
there are many ways of doing that.
If you want to do it in code behind, you'll have to loop to encrypt them. Then you can use
Table-Valued Parameters in SQL Server 2008 (ADO.NET), Bulk Upload or even DataTable/DataSet to insert the Data. Another
way is to use CLR How to: Create and Run a
CLR SQL Server User-Defined Function.
But another aproach, which i think would be better, is to use SQL encryption. Here are some links:
Encryption in SQL Server 2008 Enterprise Edition,
SERVER – Introduction to SQL Server Encryption and Symmetric
I would do it with SQL encryption.
May 31, 2011 11:07 PM|joeyan|LINK
Hi, thanks for your suggestion.
because there are another table using the same encrypt method "Simple3DES" to encrypt, so i need to use same encrypt method as i need to join table with the key. It seems that I need to do it in code behind which i have to loop to encrypt them.