Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Simple Database App - Combobox + DataGrid

Simple Database App - Combobox + DataGrid

Scheduled Pinned Locked Moved C#
helpdatabasecssdata-structures
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hollowMedia 0xFA7E
    wrote on last edited by
    #1

    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

    H 1 Reply Last reply
    0
    • H hollowMedia 0xFA7E

      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

      H Offline
      H Offline
      hollowMedia 0xFA7E
      wrote on last edited by
      #2

      ^^ Can anyone provide me some assistance? Thanks! ---- xian

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups