Search code examples
c#datatable

How to get Row Index by cell value of Datatable in C#


I have a datatable and i have around 100 rows. i want to have a select query for datatable for one value in Cell to get all the rows where the value of the cell matches.


Solution

  • Try using DataTable.Select as explained in DataTable.Select Method (String)

    To find a value in DataTable, use DataTable's Select() method:

    DataRow[] rows = dt.Select("MyColumn = 123");