Selecting rows from DataTable without using Linq

DataRow(s) from DataTable can be selected without LINQ just by using DataTable.Select() method.

string searchExpression = null; 
searchExpression = "CategoryId=" + 2; 
DataRow[] SelectedDataRows = EmailAttachment.Select(searchExpression);

SelectedDataRows will have all rows where CategoryID is 2. An overload of Select also allows to select and sort results, for more details on it

please see

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s