简体   繁体   中英

Select query from c# datatable

I have datatable with following columns.

 ID
 Name
 Dept

I want to select Name where ID = "XXX" from datatable.

Can any one please suggest how can i do that.

dt.AsEnumerable().FirstOrDefault(row => row.Field<int>("ID") == 123);

尝试这个

DataRow[] rows = DataTable.Select("ID = 'XXX'")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM