Simple Database App - Combobox + DataGrid
-
I'm trying to find the best way to accomplish this; it seems what I'm doing is far too involved. What I'd like to have is a combo box loaded with some IDs that is used to populate a datagrid that queries off of other tables (Access). The main problem I'm having is the DataSet/OleDbCommands I'm using apparently don't like having a multi-table query used. The data in the data grid is going to be a simple inner join off of a few tables, so names can be displayed as opposed to IDs. To fix this, I set up a reader, then populated a queue and used that for the datagrid. This seems like a bit much effort, so I'd rather see if there's a better way. Here's some pseudo-code for what I'm doing -
command = "select * from tab1, tab2 where id = @id" command.parameter = @id adapter = new adapter( command ) apadter.fill( dataset ) datagrid.datasource = dataset - event combochange - command.parameter.value = combo.selectedvalue adapter.fill( dataset )
This code works well if there is only 1 table in use, but as soon as multiple tables are involved, it doesn't work so well. I've found ways to link multiple tables through relations, but I just need a read-only grid display of the data. Any help is very much appreciated. ---- xian -
I'm trying to find the best way to accomplish this; it seems what I'm doing is far too involved. What I'd like to have is a combo box loaded with some IDs that is used to populate a datagrid that queries off of other tables (Access). The main problem I'm having is the DataSet/OleDbCommands I'm using apparently don't like having a multi-table query used. The data in the data grid is going to be a simple inner join off of a few tables, so names can be displayed as opposed to IDs. To fix this, I set up a reader, then populated a queue and used that for the datagrid. This seems like a bit much effort, so I'd rather see if there's a better way. Here's some pseudo-code for what I'm doing -
command = "select * from tab1, tab2 where id = @id" command.parameter = @id adapter = new adapter( command ) apadter.fill( dataset ) datagrid.datasource = dataset - event combochange - command.parameter.value = combo.selectedvalue adapter.fill( dataset )
This code works well if there is only 1 table in use, but as soon as multiple tables are involved, it doesn't work so well. I've found ways to link multiple tables through relations, but I just need a read-only grid display of the data. Any help is very much appreciated. ---- xian^^ Can anyone provide me some assistance? Thanks! ---- xian