CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2007
    Posts
    149

    Adding data and combobox from multiple tables in gridview

    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???
    [code]
    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();
    }
    }
    [code]

    Look at screen shot from what i see in gridview
    Thanks,
    Attached Images Attached Images
    Last edited by shah123; March 12th, 2009 at 07:06 PM. Reason: title changed

  2. #2
    Join Date
    Mar 2007
    Posts
    149

    Re: Adding data and combobox from multiple tables in gridview

    Any help pls

  3. #3
    Join Date
    Mar 2007
    Posts
    149

    Re: Adding data and combobox from multiple tables in gridview

    Any help i really need to solve this issue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured