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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Problem populating multiple Combobox from Access Database..................pls help...........!!!

Problem populating multiple Combobox from Access Database..................pls help...........!!!

Scheduled Pinned Locked Moved C#
helpdatabasequestion
5 Posts 3 Posters 1 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.
  • V Offline
    V Offline
    Verghese
    wrote on last edited by
    #1

    Multiple combo-boxes are being populated using a single Access database.........but everytime I select any of the combo-box, the values in all other combo boxes also changes accordingly........since I want to generate a report using multiple selections of combo-box I want all combo-boxes to have different values of my choice.......how can i do that.........pls help me out.......!!! - Thanks

    L 1 Reply Last reply
    0
    • V Verghese

      Multiple combo-boxes are being populated using a single Access database.........but everytime I select any of the combo-box, the values in all other combo boxes also changes accordingly........since I want to generate a report using multiple selections of combo-box I want all combo-boxes to have different values of my choice.......how can i do that.........pls help me out.......!!! - Thanks

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You asked the same question[^] two days ago and did not respond to my answer

      V 1 Reply Last reply
      0
      • L Lost User

        You asked the same question[^] two days ago and did not respond to my answer

        V Offline
        V Offline
        Verghese
        wrote on last edited by
        #3

        Thanks for the reply.........but I'm not getting any clue as how can I use multiple datasources when I'm using only one Access database............"empDB" is the access table and "EmpdID" is the field and likewise other fields in the same way.... pls see the used code below and guide ........ *********************************************************************************** comboID.DataSource = myDS.Tables["empDB"]; comboID.DisplayMember = "EmpID"; comboName.DataSource = myDS.Tables["empDB"]; comboName.DisplayMember = "EmpName"; comboProfession.DataSource = myDS.Tables["empDB"]; comboProfession.DisplayMember = "EmpProfession"; comboCountry.DataSource = myDS.Tables["empDB"]; comboCountry.DisplayMember = "EmpCountry"; ***********************************************************************************

        D 1 Reply Last reply
        0
        • V Verghese

          Thanks for the reply.........but I'm not getting any clue as how can I use multiple datasources when I'm using only one Access database............"empDB" is the access table and "EmpdID" is the field and likewise other fields in the same way.... pls see the used code below and guide ........ *********************************************************************************** comboID.DataSource = myDS.Tables["empDB"]; comboID.DisplayMember = "EmpID"; comboName.DataSource = myDS.Tables["empDB"]; comboName.DisplayMember = "EmpName"; comboProfession.DataSource = myDS.Tables["empDB"]; comboProfession.DisplayMember = "EmpProfession"; comboCountry.DataSource = myDS.Tables["empDB"]; comboCountry.DisplayMember = "EmpCountry"; ***********************************************************************************

          D Offline
          D Offline
          darkelv
          wrote on last edited by
          #4

          Verghese wrote:

          comboID.DataSource = myDS.Tables["empDB"]; comboID.DisplayMember = "EmpID"; comboName.DataSource = myDS.Tables["empDB"]; comboName.DisplayMember = "EmpName"; comboProfession.DataSource = myDS.Tables["empDB"]; comboProfession.DisplayMember = "EmpProfession"; comboCountry.DataSource = myDS.Tables["empDB"]; comboCountry.DisplayMember = "EmpCountry";

          You are using the same data source (see bold). To have each combobox be selected seperately, have 4 different DataSet to be assigned to the 4 combo boxes.

          V 1 Reply Last reply
          0
          • D darkelv

            Verghese wrote:

            comboID.DataSource = myDS.Tables["empDB"]; comboID.DisplayMember = "EmpID"; comboName.DataSource = myDS.Tables["empDB"]; comboName.DisplayMember = "EmpName"; comboProfession.DataSource = myDS.Tables["empDB"]; comboProfession.DisplayMember = "EmpProfession"; comboCountry.DataSource = myDS.Tables["empDB"]; comboCountry.DisplayMember = "EmpCountry";

            You are using the same data source (see bold). To have each combobox be selected seperately, have 4 different DataSet to be assigned to the 4 combo boxes.

            V Offline
            V Offline
            Verghese
            wrote on last edited by
            #5

            Anyway, Thanx for the reply...........but I got it the other way round........see code below...... ******************************************************************************************* OleDbConnection con = new OleDbConnection(connectionString); OleDbCommand cmd = new OleDbCommand("select emp_name,emp_desig from emp", con); con.Open(); OleDbDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { comboBox1.Items.Add(dr[0]); comboBox2.Items.Add(dr[1]); //add as many comboboxes you want to } dr.Close(); *******************************************************************************************

            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