Better to use join query and fill the dataset...Use Production Manager ID in where clause of join condition..Can you give more clarification
importing data from two tables into datagrid view
-
03-06-2023 - |
Question
i am populating my data grid from my ms access database i am using this code
daProductionBatch = New OleDbDataAdapter("select * from [ProductionBatchDetails] where Product_ID like '" + txtProductID.Text + "%'", conn)
daProductionBatch.Fill(dsProductionBatch, "ProductionBatchDetails")
dgvHistory.DataSource = dsProductionBatch.Tables("ProductionBatchDetails")
dgvHistory.Columns.Item(0).HeaderCell.Value = "Production Batch ID"
dgvHistory.Columns.Item(0).Width = 100
dgvHistory.Columns.Item(1).HeaderCell.Value = "Product ID"
dgvHistory.Columns.Item(1).Width = 150
dgvHistory.Columns.Item(2).HeaderCell.Value = "Quantity Produced"
dgvHistory.Columns.Item(2).Width = 200
dgvHistory.Columns.Item(3).HeaderCell.Value = "Production Manager ID"
dgvHistory.Columns.Item(3).Width = 100
dgvHistory.Columns.Item(4).HeaderCell.Value = "Date of Production"
dgvHistory.Columns.Item(4).Width = 100
daProductionbatch is Data Adapter and dsProductionbatch is the data set this table is linked to an other with the Production Manager ID field, i want to access that table and get the corresponding Production Manager Name as well Please tell me how can i do this
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow