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

Issues changing the value of an element in an array in matlab -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

vb.net - Alternative to the T-SQL AS keyword -