c# - How to use EXISTS in DataTable filterExpression? -


i need exists filtering datatable in c#.net have tried

string sortexpression="id asc"; string filterexpression; datatable dt; datarow[] dra; filterexpression = "exists (select distinct id table_b b a.id=b.id )"; dra = dtadvancedsearched.select(filterexpression, sortexpression); dt = dra .copytodatatable(); 

but generate error

please can 1 me use exists in .net

there no exists in in rowfilter syntax.

so suggest use linq-to-dataset instead:

ienumerable<datarow> tablebrows = table_b.asenumerable(); datatable dt = dtadvancedsearched.asenumerable()     .where(row => tablebrows.any(b => b.field<int>("id") == row.field<int>("id")))     .orderby(row => row.field<int>("id"))     .copytodatatable(); 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -