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. Add data in gridview from multiple tables and combobox [modified]

Add data in gridview from multiple tables and combobox [modified]

Scheduled Pinned Locked Moved C#
databasehelpquestion
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
    haroon1980
    wrote on last edited by
    #1

    Hi, Basically i am trying to make a combobox in 2nd row of gridview... two issues in below function: Two things: 1. Now adapter2 is populated in gridview and i do not see any combobox instead i see only columns from adapter2 2. I do not see the adapter1 filled at all???

    void fillData()
    {
    database = new OleDbConnection(connectionString);
    database.Open();
    OleDbDataAdapter adapter1 = new OleDbDataAdapter("select BillD.ProductName,BillD.ProductID,BillD.Saletype,BillD.InQty,BillD.SBtype,BillD.Dis1,BillD.Type,BillD.InPrice from BillDetails BillD", database);
    OleDbDataAdapter adapter2 = new OleDbDataAdapter("Select Products.ProdID,Products.ProductName,Packing.PackingName from Packing INNER JOIN Products ON Packing.PackingID=Products.Packing", database);

    {
    DataGridViewComboBoxColumn dgridcolumn = new DataGridViewComboBoxColumn();
    DataSet ds = new DataSet();
    DataTable dt = new DataTable();
    DataTable packDT = new DataTable();
    adapter1.Fill(dt);
    dataGridView1.DataSource = dt;
    adapter2.Fill(packDT);
    ds.Tables.Add(packDT);
    dataGridView1.DataSource = ds;
    dataGridView1.DataMember = ds.Tables[0].TableName;
    dgridcolumn.DataSource = ds.Tables[0];
    dgridcolumn.ValueMember = ds.Tables[0].Columns[1].ColumnName.ToString();
    }
    }

    Thanks, Please help

    modified on Friday, March 13, 2009 4:51 AM

    H 1 Reply Last reply
    0
    • H haroon1980

      Hi, Basically i am trying to make a combobox in 2nd row of gridview... two issues in below function: Two things: 1. Now adapter2 is populated in gridview and i do not see any combobox instead i see only columns from adapter2 2. I do not see the adapter1 filled at all???

      void fillData()
      {
      database = new OleDbConnection(connectionString);
      database.Open();
      OleDbDataAdapter adapter1 = new OleDbDataAdapter("select BillD.ProductName,BillD.ProductID,BillD.Saletype,BillD.InQty,BillD.SBtype,BillD.Dis1,BillD.Type,BillD.InPrice from BillDetails BillD", database);
      OleDbDataAdapter adapter2 = new OleDbDataAdapter("Select Products.ProdID,Products.ProductName,Packing.PackingName from Packing INNER JOIN Products ON Packing.PackingID=Products.Packing", database);

      {
      DataGridViewComboBoxColumn dgridcolumn = new DataGridViewComboBoxColumn();
      DataSet ds = new DataSet();
      DataTable dt = new DataTable();
      DataTable packDT = new DataTable();
      adapter1.Fill(dt);
      dataGridView1.DataSource = dt;
      adapter2.Fill(packDT);
      ds.Tables.Add(packDT);
      dataGridView1.DataSource = ds;
      dataGridView1.DataMember = ds.Tables[0].TableName;
      dgridcolumn.DataSource = ds.Tables[0];
      dgridcolumn.ValueMember = ds.Tables[0].Columns[1].ColumnName.ToString();
      }
      }

      Thanks, Please help

      modified on Friday, March 13, 2009 4:51 AM

      H Offline
      H Offline
      haroon1980
      wrote on last edited by
      #2

      Any help pls

      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