C# DataTable select method

Author: | Categories: Programming One Comment

DataTable has a Select method. This method receives a string expression that specifies what rows you want to handle.

Selection based on a string expression


DataRow[] result = table.Select("Size >= 230 AND Sex = 'm'");

Selection based on DateTime


DataRow[] result = table.Select("Date > #6/1/2001#");

Number of records for a particular criteria


int numberOfRecords = table.Select("IsActive = 'Y'").Length;
Comments
  1. Posted by priyanka

Leave a Reply

Your email address will not be published.