How to find all data where DataRowState is Added from DataTable?
I already try with DataView but find that, but after call AcceptChanges() from DataTable, all data that filter using DataView are gone. That because DataView filter is use reference.
I found any technique to solve that problem. I use QueryObject (i already post "Learning and implement LINQ concepts with .NET 2.0").
Below are the code (use C#):
...
DataTable dt = new DataTable();
DataRow[] rows = dt.Select();
IEnumerable iEnumDataRow = QueryObject.Where(rows, delegate(DataRow row) { return row.RowState == DataRowState.Added; });
dt.AcceptChanges();
foreach (DataRow dr in iEnumDataRow)
Console.WriteLine(dr["someColumnName"].ToString());
...
No comments:
Post a Comment