Hi,
I met a problem that after the DataTable using Select and Sort method.
The DataRow it fetch cannot get the RowIndex from the source/origin DataTable by using IndexOf.
Detail information:
-
I have 2 DataTable.
First one is Source DataTable SourceDataTable
Second one is a Copy CopyDataTable. -
I use CopyDataTable for selection and Sort. Just like below:
CopyDataTable.Select(Statement)
CopyDataTable.DefaultView.Sort = Sort Statement
CopyDataTable = CopyDataTable.DefaultView.ToTable
3.Then I loop the CopyDataTable with For Each Row
and want to know the DataRow fetch from the CopyDataTable during the iteration about the index from the SourceDataTable by the code below.
For each DataRow in CopyDataTable
SourceDataTable.Rows.IndexOf(DataRow)
But it pops up the message that it cannot find the index.
Please provide any ideas/suggestion
Thanks so much