How to query a dataset more easier

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there an easier way to query a dataset other than doing the following
code: I just want to set a variable based on the value of a input paramenter.

foreach(DataRow currentRow in dsAllData.Tables["WorkSheet"].Rows)
{

if (currentRow["WRKBK_CD"] == WorkSheet_Code)
{
WorkSheet_Name = currentRow["WS_NM"].ToString();
}
}
 
Hi Nicole,

If you'd like to query a single row, use find
method:DataSet.Tables(TableName).Rows.Find(keys)

For query multi rows : DataSet.Tables(TableName).Select(filterExpression)
 
foreach(DataRow selRow in daAllData.Tables["Worksheet"].Select("WRKBK_CD ==
" + WorkSheet_Code.ToString())
{
WorkSheet_Name = selRow["WS_NM"].ToString();
}
 
Back
Top