Skip to Content
Jun 16, 2015 at 04:24 PM

Why only 1 occurance of Child records shows on Report



I am using and my report is using 1 dataset and it has 2 tables in it. Tbl1 is the parent table, Tbl2 is the Child table and My sql statements are something like this..

1stSelect = "Select * from Tbl1 where status = 'A' and ID > 10"

myDa.Fill(myDS, "Tbl1")

2ndSelect = "Select * from Tbl2 "

myDa.Fill(myDS, "Tbl2")

The tables are linked in the dataset by column "ID" (Both tables have ID as common key field).

I do see my dataset myDS has records in it. When I placed the fields from the Dataset (Tbl2) on the report in Detail Section of the Crystal report, I can see all the fields from Tbl1 on the report, Also I see only 1 record from the Tbl2, why the other records from Tbl2 are not showing on the report?

Is there anything wrong in my SQL statements, I am not manually joining them here however I expect crystal report engine to join them when managing the relationship.

Also another question, I am only selecting a subset of records from the Database in my 1stSelect statement, however I am selecting everything in my 2ndSelect, how does crystal report group Tbl1 with matching Tbl2 records for the report? Do I need to change the 2ndSelect statement to extract only records matching with my 1stSelect? That way both tables will have matching conditions?

Please help. Thanks.