How to get datarow array refering to datatable 's field value with linq
- by Michael
I want to use linq to get datarow array from a datatable which its string type ColumnA is not null or depending on its length 0 , so I can get the row index with Indexof() method to deal with something else.
ColumnA ColumnB ColumnC
A0 B0 C0
Null B1 C1
A2 B2 C2
Null B3 C3
My Linq Statment:
DataRow[] rows = myDataTable.Select("ColumnA is not null").Where(row=>row.Field<string>("ColumnA").Length>0);
somebody who can help?