Hi list,
I have the following datatable, but do not know how to update dt. I can update events, but my aim is to update dt. Any idea please?
DataTable dt = new DataTable();dt.Columns.Add("year", typeof(int));
dt.Columns.Add("event", typeof(int));
dt.Columns.Add("lob", typeof(string));
dt.Columns.Add("loss", typeof(int));
dt.Rows.Add(1, 1,"s4444", 20);
dt.Rows.Add(1, 1,"s3333", 34);
dt.Rows.Add(1, 2, "s4444", 40);
dt.Rows.Add(1, 4, "s4444", 50);
dt.Rows.Add(2, 3, "s4444", 344);
string query = "year=1 and event=1 and lob in ('s1301','s2243')";
DataTable events = new DataTable();
events = dt.Select(query).CopyToDataTable();
foreach (DataRow row in events.Rows)
{
row["loss"] = 9999;
}
events.AcceptChanges();
dt.AcceptChanges(); //this dows not work