G
Guest
So far the dataset just shows
Type, Benefit, Change
I want it to show
Type, Benefit, Change, Description
This should be a pretty elementary question - and I've spent 2 days on it
already.
I just want to add one field from another table into my dataset, should be
easy, but maybe it's the way it is related that is making it so difficult
(there are no totally unique fields in either table, so it needs a multi-join)
I have 2 tables in the dataset already:
Membership
BENFT
To get the Desc Field from the BENFT table, I need to relate 2 fields to
Membership
Membership.Benefit = BENFT.BNFT
Membership.Change = BENFT.BCHG
'This is what I tried so far, but it's not working
daBenefits.Fill(DsBenefits1, "Membership")
Dim relBenefit As New DataRelation("relBen",
DsBenefits1.Tables(0).Columns("Benefit"),
DsBenefits1.Tables(1).Columns("BNFT"))
Dim relBenChg As New DataRelation("relChg",
DsBenefits1.Tables(0).Columns("Change"),
DsBenefits1.Tables(1).Columns("BCHG"))
DsBenefits1.Relations.Add(relBenefit)
DsBenefits1.Relations.Add(relBenChg)
daBenefitDesc.Fill(DsBenefits1, "BENFT")
'DGMembers is the DataGrid
DGBenefits.DataSource =
DsBenefits1.Tables("Membership").DefaultView
DGBenefits.DataBind()
Thank you
Note: Membership is actually a union that I have filled for each piece into
the dsBenefits1
Type, Benefit, Change
I want it to show
Type, Benefit, Change, Description
This should be a pretty elementary question - and I've spent 2 days on it
already.
I just want to add one field from another table into my dataset, should be
easy, but maybe it's the way it is related that is making it so difficult
(there are no totally unique fields in either table, so it needs a multi-join)
I have 2 tables in the dataset already:
Membership
BENFT
To get the Desc Field from the BENFT table, I need to relate 2 fields to
Membership
Membership.Benefit = BENFT.BNFT
Membership.Change = BENFT.BCHG
'This is what I tried so far, but it's not working
daBenefits.Fill(DsBenefits1, "Membership")
Dim relBenefit As New DataRelation("relBen",
DsBenefits1.Tables(0).Columns("Benefit"),
DsBenefits1.Tables(1).Columns("BNFT"))
Dim relBenChg As New DataRelation("relChg",
DsBenefits1.Tables(0).Columns("Change"),
DsBenefits1.Tables(1).Columns("BCHG"))
DsBenefits1.Relations.Add(relBenefit)
DsBenefits1.Relations.Add(relBenChg)
daBenefitDesc.Fill(DsBenefits1, "BENFT")
'DGMembers is the DataGrid
DGBenefits.DataSource =
DsBenefits1.Tables("Membership").DefaultView
DGBenefits.DataBind()
Thank you
Note: Membership is actually a union that I have filled for each piece into
the dsBenefits1