使用LINQ,查询DataSet表的字段是否包含某个值

查询 test1 这个表里的列 MATNR  是否包含 ttt 这个值  ,ttt为string类型

string ttt =  dstest2.Tables[0].Rows[0]["PN"].ToString();

//MATNR:test1的列名 
DataRow []row = test1.Tables[0].Select("MATNR = '"+ttt+"'");

 

string ttt =  dstest2.Tables[0].Rows[0]["PN"].ToString();

DataRow []row = test1.Tables[0].Select("MATNR = '"+ttt+"'");

判断是否匹配到值

  if (row.Length <= 0)
  {
           //说明 ttt这个值不在 MATNR 这一列当中           
  }

 

posted on 2021-07-30 16:24  写个笔记  阅读(349)  评论(0编辑  收藏  举报

导航