TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guido Leibbrand
NA
1
0
Remove rows from a datatable worked very slow
Jul 22 2014 12:39 PM
Hi together,
at first i get a big datatable from a oracle database (>100.000 items).
In a second step i want remove items by filtercritera.
But the way i remove the items worked very slow. Perhaps you can help me to find a faster way ;)
Why i do it on this way: There is no way to get performant a smaler datatable direct from oracle.
I hope there is a way to remove items fast from a datatable.
Here the sourcecode:
//Select useable items (works very fast)
var useable = dataTable.Select("(COLUMN1 IN (1,3,7)) AND ISNULL(DATECOLUMN1,'2014-07-22 18:04:35Z') > '2014-07-16 18:04:35Z'");
//List for the Items to delete
var listToDelete = new List<DataSet.TESTDATARow>();
//Check is datarow "useable" (works very slow 120.000 items over 40 sec.)
foreach (var rowItem in dataTable)
{
var found = useable.Contains(rowItem);
if (!found)
{
listToDelete.Add(rowItem);
}
}
//Remove items from dataTable (works very fast)
foreach (var logisticDataRow in listToDelete)
{
dataTable.Rows.Remove(logisticDataRow);
}
i use .Net 4.0
VS 2010
cheers
Guido
Attachment:
beispielfuerpost.zip
Reply
Answers (
1
)
Deleting record
How do I implement own login MVC5