|
-
Sep 14th, 2009, 02:55 PM
#1
Thread Starter
New Member
DataGridView column binding filtering...?
I'm not exactly sure how to word the title so let me apologize up front.
I have two database tables in SQL Server Express 2008 with the following layouts.
DATA
-------
id
fundKey
amount
fiscalYear
FUNDS
-------
fundKey
fundDescription
fiscalYear
Sample data for DATA table
1,1,2700,2008
1,2,3000,2008
1,1,5000,2009
Sample data for FUNDS table
1,General,2008
2,Indirect,2008
1,General,2009
2,Sponsored,2009
These two tables are related on fiscalYear and fundKey. So if you were to look at the first line in the DATA table you would get:
1,General,2700,2008
I'm trying to create a front-end for this using VB2008. I thought a DataGridView (DGV) would work well for this. So I create a small app to test out my theory. I put a DGV on it and setup a data source to the DATA table using the designer and it works great. Then I change the fundKey column to be databound to the FUNDS column, looking up the fundDescription based on the fundKey. I also change it to a combobox column because in the future I would like other users to easily change the value. And all of this works well.
My problem is in that combobox column, all the fund values are listed as options. So it lists: General, Indirect, General, Sponsored. I would like it to list only the values for the appropriate fiscal year. So if that row is for fiscalYear 2008, the fund options should be General and Indirect. And if it's 2009 the options should be General and Sponsored.
What is the best way to do this? I thought about setting up views on the SQL Server side and having two datasets in the app and switching between them. But it seems like there would be an easier way.
Thanks for reading all this. I hope I've been clear. If not let me know and I'll elaborate.
Clint
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
|