无法更改的DataRow值 [英] Unable to change DataRow value

查看:163
本文介绍了无法更改的DataRow值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想换一个数据行值。我想改变 DT2 [0] .ItemArray [3] 我尝试这个代码,但没有奏效。

 私人无效Func键(DataRow的[] DtRowTemp)
{
的DataRow [] DT2;
DT2 = DtRowTemp; //它工作和DTRowTemp值已设置为DT2

//上述代码不起作用
DT2 [0] .ItemArray [3] = 3; //最后值为2,我想改变这个价值3
}


解决方案

随着 ItemArray属性。获取或设置整个数组,而不是一个单一的值



使用此设置第四个项目:

  DT2 [0] [3] = 3; 


I want to change a Datarow value. I want to change DT2[0].ItemArray[3] I tried this code, but it didn't work.

private void Func(DataRow[] DtRowTemp)
{
    DataRow[] DT2 ;
    DT2 = DtRowTemp; // It work and DTRowTemp value has set to DT2

    // above code don't work
    DT2[0].ItemArray[3] = 3;   // Last Value Was 2 and I want to change this value to 3
}

解决方案

With the ItemArray Property you get or set the ENTIRE array, not a single value.

Use this to set the fourth item:

 DT2[0][3] = 3;

这篇关于无法更改的DataRow值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆