Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accessing Datasource for CrystalReport in other Projects

Status
Not open for further replies.

tek1ket

MIS
Jan 25, 2009
70
0
0
IR
I have a Solution with n Projects, in one of the Projects(Layer1) all of the Object collection are located , in the other Project I have the Reports and viewers, i can access the Object COllection as datasrource in Layer1 in all forms but when i want to set the datasource for the Crystal reports i cannot see those object Collection. I can see just the Object Collection which are located in the same Project.
is it possible to access the Object Collection in other projects of the same Solution for the Crystal report.

Solution
1)Project1
a)Object Collection1
2)Project2
a)ObjectCollection2
b)Form
C)CrystalReport

Form can access "Object Collection1" and "Object Collection2"
CrystalReport can access just "Object Collection2" when i click the "Database Expert-->Project Data -->.NET Objects"

I need to access "Object Collection1" in Database Expert of Crytsal Report

Thank you
 
The Crystal components can't see "outside" of the project where they're located. However, I have some thoughts about how you might be able to get this to work....

What I would do if I were writing this would be to have the project (Project1) that contains the object collection definition compile into an assembly. I would then reference that assembly in the project where my forms and reports are located (Project2) and added to the Using clauses for any forms where it is used. Any object collection that is used would actually be instantiated in Project2 where it would be available for Crystal to "see" for the reports.

The challenge with this approach is that if the same object collection instance is used in multiple forms (for example in both a data entry form and a report viewer form that is called from the data entry form) the instance will have to be passed between the forms. While I haven't done this with object collections, I have done it with DataSets. Using the example I mentioned, I would override the constructor on the report viewer form so that I can pass the object collection instance into the form and assign it to the report's DataSource.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top