In operationDatatableYou may also encounter a common problem.DatatableSome rows in modify the status,
I mean manually explicitly modified, for exampleCode:
//Adds a Status column to the new table to indicate whether the table has been accessed.
Datatable temptable = dtdatatable [I]. Copy ();
Temptable. Columns. Add ("Visited",Typeof(Bool));
Foreach(Datarow temprowInTemptable. Rows)
{
Temprow ["Visited"] =False;
}
//Then, some rows are operated and the status is modified.
Foreach(Datarow adatarowInTemptable. Rows)
{
If(Adatarow ["Stepno"]. Tostring ())
{
Adatarow ["Totalprice"] = 0;
Adatarow ["Visited"] =True;
}
}
Then Temptable There will be some Row Column Visited = false . How to find these columns?
Of course it corresponds to the question in this article
Datarow [] unvisitedrows = temptable. Select ("Visited = false");
apparently, it returns a datarow , next, how to operate on each row in the array, needless to say. One thing to note is that my
previous blog
Dataset, datatable. datarowCopy Method--Solution: This row already belongs to another table.
In addition,PublicDatarow[] Select ( String Filterexpression)
Filterexpression This parameter can also be used And, or And other operators, such: Filterexpression
="Id = 'D' or stepnt <> ''" .