Tuesday, October 14, 2008

Use DataTable.Rows.Find() Instead of DataTable.Select()

ADO.NET generates indexes on the primary key(s). So, if you have to search a datatable for records based on some primary key value, use DataTable.Rows.Find() instead of DataTable.Select(). The Find method will use the index to find the row. This turns out to be faster because of the presence of the index.

No comments: