Click here to Skip to main content
15,743,541 members
Please Sign up or sign in to vote.
1.67/5 (3 votes)
See more:
Good morning. I'm crushing my head to find a way to simulate the "IN (SELECT" sql clause.
I have two tables in a dataset and a relation between them (i. e. Orders and Articles). I neeed to filter orders containing a given article (by Id or by Description)

The structure I'm trying to reproduce is:
SELECT * FROM Orders WHERE idOrder IN (SELECT idOrder FROM Articles WHERE Articles.Description like '%something%')

Can anyone help me?

What I have tried:

I tried to search documentation in internet... without success...
Updated 4-Jun-23 22:24pm
jekin77 1-Jun-23 5:53am    
try with LINQ by using contains method
Andre Oosthuizen 1-Jun-23 6:19am    
Show us your current SQL statement for easier understanding. Use the 'Improve Question' to edit your question.
Gerry Schmitz 1-Jun-23 11:33am    
You select the articles (by "id or description"); then retrieve the related order (related, I assume, on "order id"); which implies not "articles"; but "order items" that reference an article.
PIEBALDconsult 1-Jun-23 13:22pm    
Use the RowFilter property of the DataTable's DefaultView ( DataView ).
dataset.Tables [ " ... " ].DefaultView.RowFilter = " ... " ;
Jean Ferre 3-Jun-23 8:38am    
What have you tried to do in your code so far? Could you improve your question and add some code in "What I have tried" section, please

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900