multiple relationship tables on a datagrid

Problem: The below will display: home_name, person_id, person_name, person_age, person_job
field records with no problem. However when i re-create da1 to input tb3 & tb4 and select
the company_name field to show on the datagrid as well, it doesnt display any records. The
relationships are created in the MS access already and when i used data adapter query builder,
the relationships are there as well, am i missing any steps?
-
Private Sub frmResults_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'da1 is a data adapter that has 2 tables: tb1 & tb2
'i used vs.net to drag the oledbdataadapter to select fields using sql query builder
'the datagrid will show eg: home_name, person_id, person_name, person_age, person_job
da1.Fill(ds)
dataview = ds.Tables("tb1").DefaultView

'dg is datagrid with dataview as DataSource
dg.Datasource = dataview
Table: Fields
tb1: home_id, home_name, home_type
tb2: person_id, person_name, person_age, person_job
tb3: company_id, person_id
tb4: company_id, company name
-
any advise will be appreciated!

[1184 byte] By [alfredkoo] at [2007-12-16]
# 1
Dear alfredkoo

My suggestions are:

1. Remove the view, I know it is a recommendation to use views but I am suspecting that using tb1 in the view and binding the view to the Grid hides the rest of data.

2. Re-generate the Data Set, Delete the current DataSet and at the design time, right click the DataAdapter and choose GenerateDataSet.

3.When the DataSet contains more than one table, and you bind it to the DataGrid, I prefer you bind it programatically:

dataGrid.datasource = dataset
dataGrid.datamember = dataset.tables(index as integer or table name as string)
Try them and I am waiting for your reply.

You are welcome

Haitham.ElGhaareeb at 2007-9-8 > top of Msdn Tech,Visual Basic,Visual Basic General...