This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C35525.89B187D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I have a table with 2 foreign keys in it that refer back to the same =
table.
Table 1: TM_CTP_Clocking_Type (Dataset =3D dsLookup)
CTP_ID Int (PK)
CTP_DESCRIPTION String
Table 2: TM_CLK_Clockings (Dataset =3D dsEmp)
CLK_ID Int (PK)
CLK_IN_CTP_ID Int (FK to Table 1)
CLK_OUT_CTP_ID Int (FK to Table 1)
CLK_FIELD1 String
etc... =20
I have a form with several Textboxes that are bound to other fields in =
Table 2 and they work fine. On the same form, I also have 2 Combo =
Boxes that are populated with Descriptions from Table 1, and the =
SelectedValue is set according to the value of the Foreign Keys in Table =
2. My problem is at Runtime, both ComboBoxes are set to the same value =
(that of the second Combo box "cmbCLK_OUT_CTP_ID" - or second Data =
Binding?).
Here is my Data Binding code:=20
With Me.cmbCLK_IN_CTP_ID
.DataSource =3D dsLookup.TM_CTP_Clocking_Type
.ValueMember =3D "CTP_ID"
.DisplayMember =3D "CTP_DESCRIPTION"
.SelectedIndex =3D -1
.DataBindings.Clear()
.DataBindings.Add(New Binding("SelectedValue", dsEmp, =
"TM_CLK_Clockings.CLK_IN_CTP_ID"))
End With
With Me.cmbCLK_OUT_CTP_ID
.DataSource =3D dsLookup.TM_CTP_Clocking_Type
.ValueMember =3D "CTP_ID"
.DisplayMember =3D "CTP_DESCRIPTION"
.SelectedIndex =3D -1
.DataBindings.Clear()
.DataBindings.Add(New Binding("SelectedValue", dsEmp, =
"TM_CLK_Clockings.CLK_OUT_CTP_ID"))
End With
When I comment out the code for the second ComboBox's Data Binding, I =
get the correct result in the first Combo Box.
Am I doing something wrong in the code or is having 2 relationships to =
the same table too much for .NET Data Binding?
Many Thanks,
Joe
--=20
Joe Hanna
Advanced Software Engineering
joe.hanna_AT_advancedsoftware_DOT_net_DOT_au
------=_NextPart_000_0008_01C35525.89B187D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>I have a table with 2 foreign keys in it that refer =
back to=20
the same table.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Table 1: =
TM_CTP_Clocking_Type =20
(Dataset =3D dsLookup)</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2> =
=20
=20
CTP_ID &=
nbsp; Int (PK)</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> =
=20
=20
CTP_DESCRIPTION String</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Table 2: =20
TM_CLK_Clockings (Dataset =3D=20
dsEmp)</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2> =
=20
=20
CLK_ID &=
nbsp; Int (PK)</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> =
=20
=20
CLK_IN_CTP_ID Int =
(FK to=20
Table 1)</FONT></DIV>
<DIV><FONT size=3D2>
<DIV><FONT face=3D"Courier New" size=3D2>
<DIV><FONT face=3D"Courier New" size=3D2> =
=20
=20
CLK_OUT_CTP_ID Int (F=
K to=20
Table 1)
<DIV><FONT face=3D"Courier New" size=3D2> =
=20
=20
CLK_FIELD1 Str=
ing</FONT></DIV>
<DIV></FONT></FONT> =
e=
tc... &n=
bsp; =20
</DIV></DIV></DIV></FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>I have a form with several Textboxes that are bound =
to other=20
fields in Table 2 and they work fine. On the same form, I also =
have =20
2 Combo Boxes that are populated with Descriptions from Table 1, =
and the=20
SelectedValue is set according to the value of the Foreign Keys in Table =
2. My problem is at Runtime, both ComboBoxes are set to the same =
value=20
(that of the second Combo box "cmbCLK_OUT_CTP_ID" - or second Data=20
Binding?).</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Here is my Data Binding =
code:</FONT> </DIV>
<DIV><FONT size=3D2></FONT> </DIV><FONT size=3D2>
<DIV><BR><FONT face=3D"Courier New"> With=20
Me.cmbCLK_IN_CTP_ID</FONT></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><FONT face=3D"Courier =
New"> =20
.DataSource =3D=20
dsLookup.TM_CTP_Clocking_Type<BR> &nbs=
p;=20
.ValueMember =3D "CTP_ID"<BR> =20
.DisplayMember =3D =
"CTP_DESCRIPTION"<BR> =20
.SelectedIndex =3D -1</FONT></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><FONT face=3D"Courier =
New"> =20
.DataBindings.Clear()<BR> =20
.DataBindings.Add(New Binding("SelectedValue", dsEmp,=20
"TM_CLK_Clockings.CLK_IN_CTP_ID"))</FONT></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><FONT face=3D"Courier New"> End=20
With</FONT></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><FONT face=3D"Courier New"> With=20
Me.cmbCLK_OUT_CTP_ID</FONT></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><FONT face=3D"Courier =
New"> =20
.DataSource =3D=20
dsLookup.TM_CTP_Clocking_Type<BR> &nbs=
p;=20
.ValueMember =3D "CTP_ID"<BR> =20
.DisplayMember =3D =
"CTP_DESCRIPTION"<BR> =20
.SelectedIndex =3D -1</FONT></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><FONT face=3D"Courier =
New"> =20
.DataBindings.Clear()<BR> =20
.DataBindings.Add(New Binding("SelectedValue", dsEmp,=20
"TM_CLK_Clockings.CLK_OUT_CTP_ID"))</FONT></DIV>
<DIV><FONT face=3D"Courier New"></FONT> </DIV>
<DIV><FONT face=3D"Courier New"> End=20
With</FONT></FONT></DIV><FONT size=3D2>
<DIV><BR>When I comment out the code for the second ComboBox's Data =
Binding, I=20
get the correct result in the first Combo Box.</DIV>
<DIV> </DIV>
<DIV>Am I doing something wrong in the code or is having 2 relationships =
to the=20
same table too much for .NET Data Binding?</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Many Thanks,</DIV>
<DIV>Joe</DIV>
<DIV> </DIV>
<DIV>-- <BR><BR>Joe Hanna<BR>Advanced Software=20
Engineering<BR>joe.hanna_AT_advancedsoftware_DOT_net_DOT_au</DIV>
<DIV> </DIV>
<DIV><BR></FONT> </DIV></BODY></HTML>
------=_NextPart_000_0008_01C35525.89B187D0--