G
Gary Paris
I have two datasets. The first dataset is a selection of Contact
information with a field from a Codes table and a field from a Staff table.
When I run the Query, everything is OK. Dataset gets filled and I display
data in the Datagrid. Life is good.
I then want to fill another dataset with Events records.
Regarding the Contact and Events tables, the Contact key is "sysid". The
foreign key in the Events table is "con_id".
Here is the query for the Events table
--------------------------
SELECT event.[date], event.[time], event.[desc], event.staff,
event.client, event.con_id FROM event INNER JOIN contact ON event.con_id =
contact.sysid ORDER BY event.[date]
--------------------------
When I run the query, the dataset gets filled. I am assuming that there is
NO event record unless the keys match from the Contact table.
I then created a datarelation
Dim rel As DataRelation
rel = New DataRelation("ContactEvent", _
DS.Tables("Contact").Columns("sysid"), _
DS.Tables("Event").Columns("con_id"))
DS.Relations.Add(rel)
DG_Contact.SetDataBinding(DS, "Contact")
DG_Event.SetDataBinding(DS, "Contact.Event")
but when I run my program I get the following message:
"This constraint cannot be enabled as not all values have corresponding
parent values"
I would like to show all the contacts in the first datagrid. I would like
to show all related events in the second datagrid. How can I do this?
Thanks,
Gary
information with a field from a Codes table and a field from a Staff table.
When I run the Query, everything is OK. Dataset gets filled and I display
data in the Datagrid. Life is good.
I then want to fill another dataset with Events records.
Regarding the Contact and Events tables, the Contact key is "sysid". The
foreign key in the Events table is "con_id".
Here is the query for the Events table
--------------------------
SELECT event.[date], event.[time], event.[desc], event.staff,
event.client, event.con_id FROM event INNER JOIN contact ON event.con_id =
contact.sysid ORDER BY event.[date]
--------------------------
When I run the query, the dataset gets filled. I am assuming that there is
NO event record unless the keys match from the Contact table.
I then created a datarelation
Dim rel As DataRelation
rel = New DataRelation("ContactEvent", _
DS.Tables("Contact").Columns("sysid"), _
DS.Tables("Event").Columns("con_id"))
DS.Relations.Add(rel)
DG_Contact.SetDataBinding(DS, "Contact")
DG_Event.SetDataBinding(DS, "Contact.Event")
but when I run my program I get the following message:
"This constraint cannot be enabled as not all values have corresponding
parent values"
I would like to show all the contacts in the first datagrid. I would like
to show all related events in the second datagrid. How can I do this?
Thanks,
Gary