O'Reilly logo

Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition by David Sceppa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the DataTable Class’s Searching and Filtering Features

The DataTable class exposes two methods that you can use to locate data based on search criteria. One method, Find, lets you locate a row based on its primary key values. The other, Select, acts as more of a filter, returning multiple rows of data based on more flexible search criteria.

Locating a Row by Its Primary Key Values

When you’re querying your database for information, you’ll often want to retrieve a specific row of data based on the values of its primary key columns, using a query such as this one:

SELECT CustomerID, CompanyName, ContactName, Phone
       FROM Customers WHERE CustomerID = 'ALFKI'

You can also locate a DataRow in a DataTable based on the row’s primary key values. You might ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required