检查字符串/记录DataTable中存在 [英] Check if String / Record exists in DataTable
本文介绍了检查字符串/记录DataTable中存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个字符串,我需要检查,如果DataTable中dtPs.Rows任何一列item_manuf_id等于一定值
I have a String and I need to check if any column "item_manuf_id" in DataTable dtPs.Rows equals to certain value
我可以遍历所有行和比较
I can loop over all Rows and compare
String id = dtPs.Rows[number]["item_manuf_id"].ToString()
if ("some value".equals(id)) etc.
但我想知道是否有任何的检查方法如果数据表
包含记录
but I am wondering if there is any way to check if DataTable
contains the record
推荐答案
像这样
string find = "item_manuf_id = 'some value'";
DataRow[] foundRows = table.Select(find);
这篇关于检查字符串/记录DataTable中存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文