I have created a strongly typed dataset in the VS 2005 Dataset Designer. There are two tables that relates to each other in a one to many relationship: Claim and ClaimDetail. The designer automatically creates a function GetClaimDetailRows which returns all ClaimDetailRows for a ClaimRow. Why is this Array's length always 0? Because ClaimDetail contains more than 40 Million rows, i did'nt fill it before i call GetClaimDetailRows but had configured it's selectcommand that it takes a parameter idData to fill only the related records. But that seems not to work because the ClaimDetail-Datatable is empty.
The automaticaly generated function in the ClaimRow-Class which returns all related ClaimDetailRows:
Public Function GetClaimDetailRows() As ClaimDetailRow()
If (Me.Table.ChildRelations("Claim_ClaimDetail") Is Nothing) Then
Return New ClaimDetailRow(-1) {}
Else
Return CType(MyBase.GetChildRows(Me.Table.ChildRelations("Claim_ClaimDetail")),ClaimDetailRow())
End If
End Function
When debugging i see that it jumps into the else block but returns 0 rows. Do i have to fill the Claimdetail-Datatable first(ClearBeforeFill=True) for each Claim? But then i dont need to use this function anymore.
UPDATE: I now fill the Datatable(ClearBeforeFill=True)before i call the Child-function and it works. But i dont understand why it could not throw an exception(optionally) when i try to acess a child-relation without having that datatable being filled(at least with 0 rows). Instead of that it returns 0 rows what can be correct or incorrect and is difficult to detect. Is this a lack of design or am i missing something?