Click here to Skip to main content
15,843,498 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing a simple Job Management application for my friend. I am Using access with VB.NET. I am using Table Adapter for displaying Data. My Problem is that How to sort Multicolumn in Access Database. I am showing record according to Session e.g 2019-2020. I want to two field "Party" and "Session". Please help.. My code is only sorting one column. please help

What I have tried:

Dim recfind2 As String = ComboBox4.SelectedItem
JobsBindingSource.Filter = "Party =" & "'" & recfind2 & "'"
 Me.JobsTableAdapter.Fill(Me.JobManDataDataSet.Jobs)
Posted
Updated 19-Nov-19 0:59am
Comments
Maciej Los 26-Aug-19 16:03pm    
This part of code is not "sorting" but filtering data.

1 solution

Please, read my comment to the question first. Then, read this: Populating a DataSet from a DataAdapter | Microsoft Docs[^]


When you are filtering bindingsource, you are building an expression. See:
BindingSource.Filter Property (System.Windows.Forms) | Microsoft Docs[^]
DataColumn.Expression Property (System.Data) | Microsoft Docs[^]

So, you can use several columns in Filter statement:
VB
JobsBindingSource.Filter = String.Format("Party ='{0}' AND Session = '{1}'", recfind2, recfind3)
 
Share this answer
 
Comments
Rajan Pandit 19-Nov-19 13:28pm    
Thanks dear for your valuable solutions.. it works for me..
Maciej Los 19-Nov-19 17:15pm    
Great!
So, accept my answer as a solution.

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