Displaying related tables in dataset

mcerk

Well-known member
Joined
Nov 1, 2004
Messages
78
I have two tables in dataset:

PhoneBill
-phonenumber
-cost
-duration
.....

and

PhoneBook
-phonenumber
-surname_name

All I want to do, is actually a RIGHT JOIN between tables on phonenumber field.
I Can Not Use SQL server or anything else, so lets try to do this on dataset level.

I want to join this tables. So in Datagrid I want to display:
-phonenumber
-surename_name (if exists in phonebook)
-duration
-cost
....


Code:
I made a relation between tables in dataset
ds.Relations.Add("PhoneBill_PhoneBook", ds.Tables("PhoneBill").Columns("phonenumber"), ds.Tables("phonebook").Columns("phonenumber"), False)

the problem is, that I do not know how to display wanted data in one row:
Me.DataGrid1.DataSource = ds.Tables("MainData") 
in this case there are displayed all records from phonebill, but there the column name_surname is displayed lower as a child table.

tx in advance :rolleyes:

matej
 
You wont find anything:

A DataView is a sorted and/or filtered list of rows from 1 table only. Also, the Select method is on the DataTable and as such - cant look at other tables. (from http://objectsharp.com/Blogs/datasetfaq/)

Follow the advice at that link. If that doesnt help let us know.
 
Back
Top