none
DataGridView With 2 or 1 TableAdapter? RRS feed

  • Question

  •  

    Hi every 1

    I`m using VB.NET 2005 as well as ADO.NET 2

    I have two tables in my table in the sqlserver: Table1 & Table2. One is the Child Table and the other is the Parent Table as below:

    Table1: 

                   ID . . . . . . . . . . . . . as integer . . . . . . primary Key

                   ProductID . . . . . . .as integer . . . . . . Refer to ProductID in Table2

                   Description. . . . . . . .as string

    Table2:

                  ProductID . . . . . . .  as integer . . . . . .Primary Key

                  ProductName . . . . . as string

    OK. I have a comboBox in my from which is bounded to the Table2Bindingsorce so I can see the ProductName field on the list of the comboBox. There is two textBoxes which can filled by the user and then Updating the "ID" and "Description" fields by clicking on a Button. And also I have a dataGridView in my form which I want to show 3 fields as below:

    ID (From Table1) / ProductName (From Table2)  / Description (From Table1)

    How could I do this?

     Am I supposed to create two TableAdapters for each table?

    Or Is there a good sql command for relating to the dataGridView?

    If so could this sql command force the DataSet to be updated or the DtaGridView to be Refreshed?

    Thursday, March 8, 2007 7:37 AM