I'm trying to access related data from a database. I have a table of employees, a table of balances (hours, etc.), a table of summary data (hours, etc. from past years), and a table of fees. I have created three Relations using the Visual Studio editor (AKA it's generating the relationship code) based on the EmployeeID. Now, when I am actually writing my code, I use Employee.GetChildRows(Pfms
) (or whatever the corresponding index would be). When I use this, an exception is thrown at run-time:
"The row doesn't belong to the same DataSet as this relation."
So, I tried using Employee.GetSummaryRows (another auto-generated method, and again, using whatever the corresponding table would be). This throws nothing, but also returns no rows! I know for a fact that there are rows that should be showing up. This is really frustrating, as the current method I use is doing individual queries (like SummaryTableAdapter.SomeSp
thod) for each individual Employee and it takes a very long time to perform (obviously).
Anyone have any ideas? Is this the best way to go about it? Thanks ahead of time. Code below.
'total from summary
Dim SummaryRows() As pfmsDataSet.SummaryRow
SummaryRows = .GetSummaryRows 'returns nothing!
'OR (note that only one or the other would normally be uncommented)
SummaryRows = .GetChildRows(PfmsDataSet.Relations(6)) 'throws exception!
For Each Child In SummaryRows
Temp = Child.DollarValue
If Not Temp.HasValue Then
Temp = 0
Value = Value + Temp