|
-
Sep 24th, 2019, 09:41 AM
#1
Thread Starter
Member
Opinion on best method - How to load a DGV and Filter via comboboxes
I have a WinForm that contains 15 comboboxes (lists of last name, first name, dob, etc.) and a DataGridView used for search results. On initial load the DGV is filled with ALL records from the DB and each of the CB's are filled with the distinct values from the records. Each time a user changes a search criteria (CB) the DGV will get reloaded with matching records. The CB's also get reloaded with new results to match. (Cascading combobox I believe it's called?)
I am not new to VB.net (2 years,) but not an expert. I AM new to Entity Framework and still trying to learn.
As far as I can tell I have several options when it comes to achieving my goal. I am looking for opinion, and maybe some reference material, to get the result I need and have it working efficiently.
Option 1 - Currently I am using SqlCommands to query the DB on initial load and each subsequent CB change. This works great, but it is slow as it has to do a full query to the DB, with search criteria, to fill the DGV and all the CB's.
Option 2 - Use Entity Framework and query against that for the DGV and all CB's. I have played around with EF enough to get this to work, partially. I don't have all the search criteria set up yet, and there's a few bugs.
Option 3 - Fill a DataTable/DataView, using EF, and use "filtering." This is what I'm thinking may be the "better" solution? Loading a DataTable on initial load and then doing a SELECT and passing the results to a DataView, which would be the datasource for the DGV.
What has made this difficult for me is the fact that I am searching on joined tables. The Query is nested because the actual results will have many more records than I want to display. (duplicates due to searching joined tables.) The nested query is searching on 16 columns, but I am only displaying the distinct values for 13 of those columns.
I hope all of this makes sense. I'm not sure if ANY of these options are valid or if there is a MUCH better method to follow.
Any help would be greatly appreciated!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|