Click here to Skip to main content
12,698,600 members (24,333 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# VB VB.NET DataRow
I am using DataView.Rowfilter for getting one single row from a table for particular condition.
It's taking too much time, because I'm referring a table of thousand records around five hundred times...

Is there any other way to reduce the time for same functionality?
If we use for loop whether it will reduce the time?
Posted 14-Jan-11 21:04pm
Updated 15-Jan-11 3:00am
Dalek Dave433.3K
Dalek Dave 15-Jan-11 8:00am
Edited for Grammar and Clarity.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Why don't try you using LINQ instead?

Even better, try using multiple threads in a thread pool to do it.
Espen Harlinn 16-Jan-11 8:34am
I think he mentioned "taking much time.!!!!" - I somehow fail to see how linq can improve the speed of the application. As Dave points out - using the database engine/server solves this efficiently.
Just suggesting another option. Without sitting down and trying to actually duplicate what he's doing, it's impossible to answer with any kind of authority.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Yeah, scrap your design and redo it. If you're filtering throught thousands of rows, you're forcing RowFilter to look at each and every one of those records.

The DataTable is not indexed, so there's no way to speed it up using RowFilter. If you insist on using RowFilter, you're going to have to create your own index on the table, besed on your filter criteria, then implement a method that emulates RowFilter and uses this index to find the row it needs faster.

Or, you could skip all this work and do it the easy way by having the database find that one record for you, MUCH faster than a DataView could.
Simon_Whale 15-Jan-11 17:31pm
as always sound advice

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 15 Mar 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100