Hi jinesh,
You can filter a datatable either by using Select method or by using LINQ. Here are some examples. I am taking the below query as example.
SELECT * FROM DBQPUBS.TBILL_DETAIL WHERE KEY_TMS = '{0}' AND CAT_TRDCTL = '{1}' AND DT2_BILL = '{5}' AND CAT_BILL='{6}' WITH UR;
Using Select method
Select method will return an array of DataRow.
DataRow[] expectedRows = dss.Tables["TBILL_DETAIL"].Select("KEY_TMS = '{0}' AND CAT_TRDCTL = '{1}' AND DT2_BILL = '{5}' AND CAT_BILL = '{6}'");
Note: Replace {0},{1},{5} and {6} with corresponding input
Using LINQ
var expectedRows = from row in dss.Tables["TBILL_DETAIL"].AsEnumerable()
where row.Field<string>("KEY_TMS") == "{0}" &&
row.Field<string>("CAT_TRDCTL ") == "{1}" && row.Field<string>("DT2_BILL ") == "{5}" && row.Field<string>("CAT_BILL") == "{6}"
select row;</string></string></string></string>
Note: Replace {0},{1},{5} and {6} with corresponding input. I have used string casting for all the input. You have to change them to the correct data type.
Convert DataRow[] to DataTable
dss.Tables["TBILL_DETAIL"]= expectedRows.CopyToDataTable();
Now
dss.Tables["TBILL_DETAIL"]
will have the filtered data and that's it.