Home All Groups Group Topic Archive Search About

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

Author
3 Jan 2006 10:08 AM
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

Author
3 Jan 2006 10:22 AM
Cor Ligthert [MVP]
Thomas,

We have some samples in all kind of ways on our website, here is one using
SQL however there are much more.

http://www.vb-tips.com/default.aspx?ID=a1a84750-08df-49b4-8657-7bc3068aca2c

The keyword is datarelation.

I hope this helps,

Cor
Author
3 Jan 2006 10:30 AM
Thomas Ströehm
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
Show quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb im Newsbeitrag
news:%23MMd$9EEGHA.3064@TK2MSFTNGP14.phx.gbl...
> Thomas,
>
> We have some samples in all kind of ways on our website, here is one using
> SQL however there are much more.
>
> http://www.vb-tips.com/default.aspx?ID=a1a84750-08df-49b4-8657-7bc3068aca2c
>
> The keyword is datarelation.
>
> I hope this helps,
>
> Cor
>
Author
3 Jan 2006 10:58 AM
Cor Ligthert [MVP]
Thomas,

I am afraid that I don't understand completely your problem.

However, because I have seen this kind of problems more. Did you look at
that sample about faking the relation. (Using the relation you can not get
every dataelement, while with this faking approach you can).

http://www.vb-tips.com/default.aspx?ID=cb1408ff-030d-4ea8-80b1-af26354b1fa0

I hope this helps better,

Cor
Author
3 Jan 2006 12:43 PM
Bart Mermuys
Hi,

Show quote
"Thomas Ströehm" <tho***@stroehm.com> wrote in message
news:uyJN2CFEGHA.336@TK2MSFTNGP14.phx.gbl...
> 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


Show quote
>
> Thomas
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb im Newsbeitrag
> news:%23MMd$9EEGHA.3064@TK2MSFTNGP14.phx.gbl...
>> Thomas,
>>
>> We have some samples in all kind of ways on our website, here is one
>> using SQL however there are much more.
>>
>> http://www.vb-tips.com/default.aspx?ID=a1a84750-08df-49b4-8657-7bc3068aca2c
>>
>> The keyword is datarelation.
>>
>> I hope this helps,
>>
>> Cor
>>
>
>
Author
3 Jan 2006 1:54 PM
Thomas Ströehm
Thaks.
Thats what i was looking for !!!
Great

Thomas.
Show quote
"Bart Mermuys" <bmermuys.nospam@hotmail.com> schrieb im Newsbeitrag
news:eYNtIOGEGHA.2040@TK2MSFTNGP14.phx.gbl...
> Hi,
>
> "Thomas Ströehm" <tho***@stroehm.com> wrote in message
> news:uyJN2CFEGHA.336@TK2MSFTNGP14.phx.gbl...
>> 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
>
>
>>
>> Thomas
>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb im Newsbeitrag
>> news:%23MMd$9EEGHA.3064@TK2MSFTNGP14.phx.gbl...
>>> Thomas,
>>>
>>> We have some samples in all kind of ways on our website, here is one
>>> using SQL however there are much more.
>>>
>>> http://www.vb-tips.com/default.aspx?ID=a1a84750-08df-49b4-8657-7bc3068aca2c
>>>
>>> The keyword is datarelation.
>>>
>>> I hope this helps,
>>>
>>> Cor
>>>
>>
>>
>
>

AddThis Social Bookmark Button