You can do this in one line, just pass the appropriate action delegate to the ForEach method:
oldSP.Select(string.Format("[itemGuid] = '{0}'", itemGuid)) .ToList<DataRow>() .ForEach(r => { r["startdate"] = stDate; r["enddate"] = enDate; });
You can also use LINQ to DataSet (looks more readable to me than single-line):
var rowsToUpdate = oldSP.AsEnumerable().Where(r => r.Field<string>("itemGuid") == itemGuid); foreach(var row in rowsToUpdate) { row.SetField("startdate", stDate); row.SetField("enddate", enDate); }
source share