Multiple dropdown boxes all with SQL queries
I am trying to write a program that queries a mysql database.
The first dropdown box is popluated with an SQL query which returns a list of tables within the database. The user needs to select which table they wish to use.
Once this choice has been made I then need to poulate the second dropdown with a list of unique results from one column within that table. The user needs to select which unique type they are intested in.
Once this second choice has been made I then need to populate the third dropdown with a list of results based on both table selected and type selected.
Once this is done I neet to populate two text boxes with other data from the database in the record chosen in step 3.
I need to do this because the database has tens of thousands of records all very similar and the list to choose from in step three needs to be reduced by the filters in steps 1 and 2.
I am new to java but not SQL.
The first query is simple and the dropdown box is being filled as I want using a vector. I also have a listener to monitor user selection. What I need your help with is how to fill the next box. FYI All the queries currently use vectors. The GUI class can see the sql query classes so it can get the data to fill the boxes. If I try to allow the relevant query classes 开发者_StackOverflow社区to access the GUI class to retrive the results of the previous query I get errors all over my code. I suspect because the IDE sees this as a loop.
Any help would be appreciated.
The basic concept is this: in the select event of the dropdownlist, bind the next dropdownlist with the new data from the database.
精彩评论