Newbee: Help on child-parent relation and binding to Forms

  • Thread starter Thread starter Thomas Ströehm
  • Start date Start date
T

Thomas Ströehm

Hello,

i'm a newbee to ADO.Net. I need to create a Form that contains values of a
Childtable 'artikel' and the corresponding value of the field
'lieferant.firma' which connects through a FL-constraint to the table
'lieferant'.

I tried to bind the realtion lieferantartiekel as the datamember to the
Combobox. Doesn't work.

Is there any hint how to solve this problem ?

Thanks a lot.

Thomas
 
Thanks for this advise.
This way i got it work.

But i need to get it work WITHOUT a datagrid. only with textboxs and a
navigator.
Perhaps i did not exactly descibe my problem:

On one Form i want to display values of a Table artikel and in the same
form there is af field whis must contain teh value from a fk-relation table
lieferant. I only get it working through a master-detail relation but not
the other way round through a detail master raltion. I'm not abele to set
the datamember to the relationshipname with the datasource of articel.

I hope this states my problem a bit better.

Thomas
 
Hi,

Thomas Ströehm said:
Thanks for this advise.
This way i got it work.

But i need to get it work WITHOUT a datagrid. only with textboxs and a
navigator.
Perhaps i did not exactly descibe my problem:

On one Form i want to display values of a Table artikel and in the same
form there is af field whis must contain teh value from a fk-relation
table lieferant. I only get it working through a master-detail relation
but not the other way round through a detail master raltion. I'm not abele
to set the datamember to the relationshipname with the datasource of
articel.

I hope this states my problem a bit better.

If you're talking about a master-lookup scenario with ComboBox then you
don't need any relations, you only have to configure the ComboBox correctly,
example:

textBox1.DataBindings.Text.Add("Text", articleTable, "ArticleName");

comboBox1.DataSource = lieferantTable;
comboBox1.DisplayMember = "<your-display-column-name>";
comboBox1.ValueMember = "<your-pk-column-name>";
comboBox1.DataBindings.Add("SelectedValue", articleTable,
"<your-fk-column-name");

HTH,
Greetings
 
Back
Top