reading a value from a child row

  • Thread starter Thread starter Matthew Marsh
  • Start date Start date
M

Matthew Marsh

I have a simple master/detail application showing companies and related
contact names.
I have created a relationship between the two tables using the Dataset XML
Schema designer.

To obtain a value from the Company table I can do this -

- CurrencyManager cm =
(CurrencyManager)this.BindingContext[dataSet11,"Company"];
- string holder =
dataSet11.Tables["Company"].Rows[cm.Position]["CompanyName"].ToString();

but I cant figure out how to obtain a value from the child table when the
currency manager is bound to the data relation-

- CurrencyManager cm =
(CurrencyManager)this.BindingContext[dataSet11.Tables["Company"],"CompanyCon
tact"];

Using the currency manager above, how would I obtain the value from a child
field called "Surname" ?

Any help would be greatly appreciated.

Thanks
Matthew
 
Thanks for your reply.

I must be missing something, but the relation name does not appear when I
press the dot after the table name.

My dataset and relation were created using the IDE and XML Schema designer
(as opposed to being coded).

I am typing this -
dataSet11.Company. (but no relation name shows)

Any ideas what I am doing wrong ?

Many thanks
Matthew


Stephen Muecke said:
Matthew,
Use a period delimited navigation path
<MainTableName>.<DataRelationName>.<ChildTableColumn>
Refer Help on Binding Class for details
Stephen


Matthew Marsh said:
I have a simple master/detail application showing companies and related
contact names.
I have created a relationship between the two tables using the Dataset XML
Schema designer.

To obtain a value from the Company table I can do this -

- CurrencyManager cm =
(CurrencyManager)this.BindingContext[dataSet11,"Company"];
- string holder =
dataSet11.Tables["Company"].Rows[cm.Position]["CompanyName"].ToString();

but I cant figure out how to obtain a value from the child table when the
currency manager is bound to the data relation-

- CurrencyManager cm =
(CurrencyManager)this.BindingContext[dataSet11.Tables["Company"],"CompanyCon
tact"];

Using the currency manager above, how would I obtain the value from a child
field called "Surname" ?

Any help would be greatly appreciated.

Thanks
Matthew
 
Back
Top