c# - Clear particular column values in DataTable -


i have data table 4 fields emp_no, amountpaid, amount_adjusted, adjustment_reason

i want clear values of adjustment_reason column

i have tried below code :

for (int = adjustmenttable.rows.count - 1; >= 0; i--) {   adjustmenttable.rows[i]["adjustmentreason"] = dbnull.value; } 

its working fine. but can 1 suggest me code achieve using linq

you can write this:

adjustmenttable.rows                .oftype<datarow>()                .tolist()                .foreach(r => r["adjustmentreason"] = dbnull.value); 

but quite frankly i'm not sure how performant can large amount of data in datatable.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -