Can't create instance of Crystal Report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

For my website, I created CrystalReportTest.rpt (through the designer in VS
2005) and I'd like to be able to display it in viewer.aspx (all in the same
project). Viewer.aspx has a Crystal Report viewer but for some reason, I
can't create an instance of this report. Therefore, I can't set any of its
properties. The only way I was able to run it was through:

CrystalReportViewer.ReportSource = Server.MapPath("CrystalReportTest.rpt");

Since I'm getting a Logon page everytime I open the page with the viewer
(which I don't want), I wanted to try the solution in
http://aspalliance.com/490, but that requires me to instantiate my report.
CrystalReportTest.rpt also doesn't have any code-behind (there are no other
files related to the rpt).
Any help is appreciated. Everything's done in VS 2005 framework 2.0

Thanks,
VMI
 
Hi,


Why are you loading a report?

CR by default create a class with the same name than the report:

ReportDocument report = new CrystalReportTest();
CrystalReportViewer.ReportSource = report;
 
The report doesn't take any parameters, so I just figured it would be easier
to load the report once Viewer.aspx opens up.
Crystal Reports didn't create a class. Does it have to do with some type of
configuration when creating the report?
The problem is that it asks for login information when the report opens up.

Thanks.
 
Hi,


VMI said:
The report doesn't take any parameters, so I just figured it would be
easier
to load the report once Viewer.aspx opens up.
Crystal Reports didn't create a class. Does it have to do with some type
of
configuration when creating the report?

I find weird that CR did not create the class, did you try the code I posted
and see if it works?
The problem is that it asks for login information when the report opens
up.

This is a completely different matter, what is your data source? a dataset ?
a sql server?
 
I already found a possible solution to the login problem. But the solution
requires that I create an instance of the report, and I can't do that since
CR didn't generate a class for it.
The report doesn't have a datasource. Everything needed to run the report is
in the report. I just need to call it (I don't pass anything to it).

Thanks.
 
Back
Top