Changing columns content before binding to windows control

  • Thread starter Thread starter Spatz
  • Start date Start date
S

Spatz

Hello all,

I have created a dataset with a datatable in it. A dataadapter fills
the datatable with username, password, first name, etc.... Then I put
the datatable in the dataset. The password is encrypted before it is
saved to the db. So when the datatable is filled with the password
column the value is encrypted.

Here is the problem. I have a c# function that encrypts and decrypts
the passwords. I need to decrypt the column in the table using the c#
function. If I bind the column to a control:

ie. [txtpassword.DataBindings.Add("Text", m_ds,
"Customers.Password");]

then the text in the textbox is encrypted.

Is there a way to tell the bound control to use the data in the table,
but call a c# function to manipulate it before displaying?


Thanks in advance,
Tom
 
One way is, you can decrypt column values when you load data to datatable
after fetching from database and encrypt it before you send it to database.

Rajesh Patel
 
Rajesh,

Thank you for your response. This is the solution I came up with and
is currently implemented. I was just curious if there was a .NET
automated way to handle this.

Best Regards,
Tom


Rajesh Patel said:
One way is, you can decrypt column values when you load data to datatable
after fetching from database and encrypt it before you send it to database.

Rajesh Patel

Spatz said:
Hello all,

I have created a dataset with a datatable in it. A dataadapter fills
the datatable with username, password, first name, etc.... Then I put
the datatable in the dataset. The password is encrypted before it is
saved to the db. So when the datatable is filled with the password
column the value is encrypted.

Here is the problem. I have a c# function that encrypts and decrypts
the passwords. I need to decrypt the column in the table using the c#
function. If I bind the column to a control:

ie. [txtpassword.DataBindings.Add("Text", m_ds,
"Customers.Password");]

then the text in the textbox is encrypted.

Is there a way to tell the bound control to use the data in the table,
but call a c# function to manipulate it before displaying?


Thanks in advance,
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top