Skip to Content
0
Former Member
Jul 22, 2008 at 05:04 PM

Crystal Reports Basic in VS2008 and Entities

29 Views

I have entities created in classes. I can use these as .net objects in the database expert for the datasource on the report. When the data is pushed to the report, I do this by setting the datasource in code. The class and its properties are visible in the field explorer and when I run the report, the report displays correctly.

However, I have some problems:

1. If the entity classes do not exist in the project (they exist in a separate assembly I'll refer to as the entity assembly), I cannot see them in the database expert unless I create a class in the report project that is derived from the entity class. Shouldn't they be visible as long as the assembly is reference? In .net I can access any class of any assembly as long as it is reference.

2. Currently, for the actual gathering of data, the app uses the entities to populate a datareader. For my testing purposes, I took the datareader and populated a list with it and then set the datasource of the report to the list successfully. However, what to do in the case of child tables? Let's say I create 3 separate datareaders (1 parent and 2 children). How do I programmatically set the datasource to those 3 datareaders or 3 lists?

3. As an alternative to #2 above, what about an entity class that contains a collection that holds the child records. How best to take that object and make it a source that crystal reports will recognise as a parent-child relationship and see the data? What are the options?

4. Another problem I am having is with setting the link between the 3 entity classes that are visible in the field explorer. All of the classes return as strings but when I try to set a link in the link window, crystal reports thinks they are of different types because the names are different.

Any help would be appreciated.