foreach(DataRow dr in dt.Rows)
{
dr["column"] = defaultValue
}
Just set the .DefaultValue property in the column. This will save some seconds.
dt.Columns["column"].DefaultValue = defaultValue;
You can also set expressions for calculated fields, per example if you want to concatenate the values of two columns.
dt.Columns["column"].Expression = "Column1+Column2";
0 comments:
Post a Comment