Datatable can be sorted using DataTable.Select()
Importing DataTable.Select() method results into another DataTable
Putting the results from a Select() query into another DataTable is often a requirement say for instance if you wanted to bind your results to a control. As mentioned above the Select() method returns an array of DataRows and since DataRows are the main building blocks of DataTables the process is very easy. Steps outlined are:
//copy the schema of source table
DataTable above24 = dt.Clone();
//get only the rows you want
DataRow results = dt.Select(”age > 24″);
//populate new destination table
foreach (DataRow dr in results)
Can’t I just use a DataView instead of calling DataTable.Select()?
You can and DataViews are directly bindable to many controls too, however it is not always the best solution due to the generally accepted believe among many developers that .Select() is much faster than using the DataView equivalent of RowFilter (property). I regularly interchange between the two for a lot of small database projects, however for the projects where I need to be processing a mega amount of data I pretty much stick with .Select() 100% of the time as I reckon it provides real speed (as in seconds, not PC invisible micro time) advantages compared to DataViews
In our particular case with a datatable of 75K rows, the using a dataview with a complex filter was nearly twice as fast as the equivalent select.
I faced a weird issue today, Metadata for document which has lookup column was not updating even after saving the item. There was no erro...
There are three different classes you can use to query SharePoint list:- 1. SPQuery Used for query a data from a specific li...
It is a permission issue. DateTimeControl field uses the iframe calender page to render the actual calender. The location of iframe...
Use below function to clear the people picker control values from page on client side. Code: