Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I created a sql server database and is using a dataset in visual studio to connect to the sql server database and I am using wpf application with a datagrid. Now in one section i need to use dataview.rowfilter.

But i need to use multiple columns to filter row in dataview.

What I have tried:

DataView View = SchoolDataset.Marks.DefaultView;

View.RowFilter = string.Format("ID = '{0}' ", ID};

this works correctly. But this will show multiple rows with the same ID.

or

DataView View = SchoolDataset.Marks.DefaultView;

View.RowFilter = string.Format("ExtracurricularActivity = '{0}' ", EA};

and this will also work, but will again show multiple rows with the same extracurricularactivity EN.

I need it to show it as one row. That if ID is 1 and extracurricularactivity is drama. Then I need the datagrid to show the row with both ID as 1 and EN as drama. There will only be one row. So how can I do that. Thank you.
Posted
Updated 2-Aug-21 3:57am

1 solution

This is where you might find what you seek:
DataColumn.Expression Property (System.Data) | Microsoft Docs[^]
 
Share this answer
 

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