Agnes,
| I try the following for-loop before, However, my table got 4000 records.
it
| takes too many times to remove it.
| over 5-8 minutes. my client complaint that.
The code I gave should take fractions of a second. 5 -8 seconds tops! On my
Pentium III 866 its takes 00:00:00.2403456 (thats .24 seconds) to delete
3999 rows.
What size of a machine are you running on?
How much memory?
What OS?
What is is going on on the machine?
Instead of removing the "check = false" rows, have you considered importing
the "check = true" rows into a new (cloned) datatable?
Something like:
Dim checked As DataTable = dtRvDetail.Clone()
For Each row As DataRow In dtRvDetail.Select("check = true")
checked.ImportRow(row)
Next
Then any further processing occurs on checked instead of dtRvDetail.
Hope this helps
Jay
| Thanks Jay,
| I try the following for-loop before, However, my table got 4000 records.
it
| takes too many times to remove it.
| over 5-8 minutes. my client complaint that.
| "Jay B. Harlow [MVP - Outlook]" <
[email protected]>
¼¶¼g©ó¶l¥ó·s»D:%
[email protected]...
| > Agnes,
| > Use a for each on your DataRow array removing each entry.
| >
| > Something like:
| >
| > For Each row As DataRow In dtRvDetail.Select("check = false ")
| > dtRvDetail.Rows.Remove(row)
| > Next
| >
| > Because DataTable.Select returns an array of Rows, you can safely remove
| > the
| > rows from the underlying DataTable.Rows collection.
| >
| > Hope this helps
| > Jay
| >
| > | > |I need to Load 4thousand record into a datagrid for the user to choose.
| > | After the user click the row, I will save it.
| > | Now, How can I remove the uncheck row.
| > | Dim myDelRowArray() As DataRow = dtRvDetail.Select("check = false ")
| > | Me.dtRvDetail.Rows.Remove(myDelRowArray) <-- I know there is error,
| > since
| > i
| > | cannot delete the datarowarray.
| > |
| > | Any simple and easy way ??
| > | thanks a lot
| > |
| > |
| > |
| >
| >
|
|