2016-05-10 106 views
1

首先我最後一次更新文件從DB更改數據行的字段值

DataTable excelData = ReadSCOOmega(lastUploadFile); 

,這個遍歷這個數據後

foreach (DataRow currentRow in rows) 
{ 
    currentRow. 
} 

這有可能改變在foreach loop.I DA數據只能訪問在這個數據

currentRow.Field<object>("Some column name") 

但不是價值變動it.My想法被選中。我在excel文件中有多個交易,何時上傳到數據庫,我需要對此文件進行更改。是否有可能或者我需要將數據存儲在其他集合中?

回答

3

你可以這樣做:

foreach (DataRow currentRow in excelData.Rows) 
{ 
    currentRow.BeginEdit(); 
    currentRow["ColumnName"] = value; 
    //..... 
    currentRow.EndEdit(); 
}