Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# visualc中数据表的包装器#_C# - Fatal编程技术网

C# visualc中数据表的包装器#

C# visualc中数据表的包装器#,c#,C#,在我的Visual C程序中,我有一个文本框,它绑定到数据表中的一个字段。数据库中的字段是加密的,我希望应用程序在将字段显示在文本框中之前对其进行解密。据我所知,我需要在数据表周围有一个包装器,它允许重写用于获取数据行字段值的方法,但我不知道如何创建它。请在你的答案中详细说明,因为我是C#编程新手。举个例子就好了。ASPX <%# Decrypt( DataBinder.Eval(Container.DataItem, "BoundedFieldName")) %> 。。。 thi

在我的Visual C程序中,我有一个
文本框
,它绑定到
数据表
中的一个字段。数据库中的字段是加密的,我希望应用程序在将字段显示在
文本框中之前对其进行解密。据我所知,我需要在
数据表
周围有一个包装器,它允许重写用于获取
数据行
字段值的方法,但我不知道如何创建它。请在你的答案中详细说明,因为我是C#编程新手。举个例子就好了。

ASPX

<%# Decrypt( DataBinder.Eval(Container.DataItem, "BoundedFieldName")) %>
。。。
this.dataGridView1.RowsAdded+=新的DataGridViewRowsAddedEventHandler(dataGridView1_RowsAdded);
}
void dataGridView1_RowsAdded(对象发送方,DataGridViewRowsAddedEventArgs e){
DataGridViewRow行;
for(int i=0;i

简单地说,您可以将数据源转换为List,TmpClass有一个属性来获取加密字段,然后将此列表设置为数据源。

新到C#-编程并且已经使用数据库和加密?我们可以假设你知道什么?对C语言编程来说是新手,但在其他平台和语言方面经验丰富!给我一个答案,我会问你任何我不知道的问题。你想更新文本并将其写回数据库,加密吗?@Patrick:不,我只想解密加密的数据。但是,我们也欢迎一个同时具备这两种功能的解决方案!:)这是针对webforms的。我说的是winforms。谢谢你的回复。您能告诉我如何使用文本框而不是GridView做同样的事情吗?@xling您能提供更多关于(您可以将数据源转换为List)的信息吗?
protected string Decrypt(object encryptedStr){
  // decode}
...
        this.dataGridView1.RowsAdded += new DataGridViewRowsAddedEventHandler ( dataGridView1_RowsAdded );
    }

    void dataGridView1_RowsAdded(object sender , DataGridViewRowsAddedEventArgs e) {
        DataGridViewRow row;
        for ( int i = 0 ; i < e.RowCount ; i++ ) {
            row = this.dataGridView1.Rows[i + e.RowIndex];
            if ( row.IsNewRow )
                continue;
            row.Cells["Encrypted"].Value = ToMD5( "111" );
        }
    }