Note that there are some explanatory texts on larger screens.

plurals
  1. PODataView.RowFilter Vs DataTable.Select() vs DataTable.Rows.Find()
    primarykey
    data
    text
    <p>Considering the code below:</p> <pre><code>Dataview someView = new DataView(sometable) someView.RowFilter = someFilter; if(someView.count &gt; 0) { …. } </code></pre> <p>Quite a number of articles which say Datatable.Select() is better than using DataViews, but these are prior to VS2008.</p> <p><a href="http://geekswithblogs.net/chrisfalter/archive/2006/08/15/88057.aspx" rel="noreferrer">Solved: The Mystery of DataView's Poor Performance with Large Recordsets</a> <br> <a href="http://geekswithblogs.net/chrisfalter/archive/2006/08/04/87143.aspx" rel="noreferrer">Array of DataRecord vs. DataView: A Dramatic Difference in Performance</a> </p> <p>Googling on this topic I found some articles/forum topics which mention Datatable.Select() itself is quite buggy(not sure on this) and underperforms in various scenarios.</p> <p>On this(<a href="http://msdn.microsoft.com/en-us/library/ms971481.aspx" rel="noreferrer">Best Practices ADO.NET</a>) topic on msdn it is suggested that if there is primary key defined on a datatable the findrows() or find() methods should be used insted of Datatable.Select().</p> <p>This article <a href="http://www.windowsitpro.com/article/aspnet2/choose-wisely.aspx" rel="noreferrer">here</a> (.NET 1.1) benchmarks all the three approaches plus a couple more. But this is for version 1.1 so not sure if these are valid still now. Accroding to this DataRowCollection.Find() outperforms all approaches and Datatable.Select() outperforms DataView.RowFilter.</p> <p>So I am quite confused on what might be the best approach on finding rows in a datatable. Or there is no single good way to do this, multiple solutions exist depending upon the scenario?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload