2011-07-30 51 views
2

我想更改Datarow值。我想更改DT2[0].ItemArray[3]我試過這段代碼,但沒有奏效。無法更改DataRow值

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 
} 

回答

6

隨着ItemArray Property獲取或設置整個數組,而不是單個值。

使用此控制設置的第四項:

DT2[0][3] = 3; 
+2

或者只是'DT2 [0] [3] = 3;' – shf301

+0

@ shf301,事實上。謝謝,我會將其添加到答案中。 –

+0

哇,謝謝。它的工作 –