Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
when combining two tables in a gridview, data shows in different rows

Unanswered when combining two tables in a gridview, data shows in different rows

  • Friday, August 24, 2012 4:35 PM
     
     

    I have a problem, when I combine selected data from two tables to show in a gridview, the gridview show all the categories correctly at the top, and the data all shows, but in differente rows (data from table 1 in row 0 and table 2 in row 1) why? I'm not using inner join cause the two tables are already joined in a diagram by "ClientId", so I put them in different datasets (ds1 and ds2) and use merge ds1 with ds2.

    Name       Last Name      Registration    Purchases

    Mike           Smith

                                            5/11/2011           3

All Replies

  • Friday, August 24, 2012 11:29 PM
     
     

    So does your merged DataSet actually result in 2 different DataTables? From what you're saying, it sounds like you just want one DataTable, is this correct? How are you binding to your grid? And what do you mean by "I'm not using inner join cause the two tables are already joined in a diagram by "ClientId""? Oh, and one more question, you said "gridview", so I'm assuming ASP.NET, not WinForms ... correct? If so, you may need to post to the asp.net forums, but first let's see if it's an DataSet problem, which maybe we can resolve here.

    Could you post the relevant code: the code you use to get the data into the 2 DataSets,  the code you use to merge them and the code you used to bind to the grid.


    ~~Bonnie Berent DeWitt [C# MVP]

    geek-goddess-bonnie.blogspot.com

  • Tuesday, August 28, 2012 10:41 AM
    Moderator
     
     

    Hi Beryamy,

    Could you please show us the code?

    What's the structure of the two datatable and what' the data in them?

    Does the fist row of the second datatable contain a blank row?

    Does the two datatables have a same primary key? If so, then it will merge according to the primary key.

    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us