Function to update column RRS feed

  • Question

  • User-313791273 posted

    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>=[201105]')"
            Using connection As New System.Data.SqlClient.SqlConnection(SqlDataSource1.ConnectionString)
                Dim command As New System.Data.SqlClient.SqlCommand(cmdString, connection)
            End Using

    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)
                    End If

    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 ?



    Tuesday, May 31, 2011 5:03 AM


All replies