When I navigate through records in a DataGridView, it should change the records in another DataGridView, but it doesn't. Help!

Unanswered When I navigate through records in a DataGridView, it should change the records in another DataGridView, but it doesn't. Help!

  • 2012년 2월 27일 월요일 오전 2:28
     
     
    I have been going through the example Walkthrough: Connecting to Data in a SQL Server Express Database (Windows Forms), and I can scroll up and down the Customers table (the parent table) in a DataGridView and that automatically finds the relevant records in the Orders table (the child table) that have the same CustomerID and it displays them on my second DataGridView component, and everything works OK. But now I want to do the opposite of that: I want to be able to scroll through the Orders (child) table and it will show me in the Customers (parent) table the CompanyName, the ContactName, the ContactTitle, etc. for that order. How do I do this? I tried adding the Orders datasource to my form, and then adding the Customers datasource, but the two DataGridView are not connected (scrolling through Orders doesn't change Customers). What am I doing wrong?

모든 응답

  • 2012년 3월 1일 목요일 오전 3:28
    중재자
     
     
    Hi Dwigt,

    How do you add Orders table as the datasource? Like drag Orders table from the Data Sources  Windows?

    To create data-bound controls on the form


    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us

  • 2012년 3월 1일 목요일 오후 10:47
     
     
    Yes that is exactly what I do.
  • 2012년 3월 6일 화요일 오전 2:42
     
     

    I am still struggling with this. If I put just the Orders table on the form, I can scroll through it and see every one of the 830 records just fine. Each of these order records has an EmployeeID, which is linked to the Employee table. Now all I want to do is be able to see those other fields in the Employee table that correspond to that EmployeeID as I'm scrolling through records in the Orders table. How do I do this?


    • 편집됨 Dwigt 2012년 3월 6일 화요일 오전 2:42
    •