Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# 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
Edited 15-Jan-11 3:00am
v3
Comments
Dalek Dave at 15-Jan-11 8:00am
   
Edited for Grammar and Clarity.
Rate this: bad
good
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.
  Permalink  
Comments
Espen Harlinn at 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
good
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.
  Permalink  
Comments
Simon_Whale at 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
0 OriginalGriff 7,130
1 DamithSL 5,089
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,647
4 Kornfeld Eliyahu Peter 4,409


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 15 Mar 2011
Copyright © CodeProject, 1999-2014
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