Pergunta

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

Foi útil?

Solução

Better to use join query and fill the dataset...Use Production Manager ID in where clause of join condition..Can you give more clarification

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top