Link to home
Start Free TrialLog in
Avatar of jpwallen
jpwallenFlag for United States of America

asked on

Crystal report fails when programmatically adding parameters.

I have a web page in ASP.net development. This page has a CrystalReportDataSource and a CrystalReportViewer. I set the ReportSources file name at runtime and databind the ReportView. This works both on my development side and the production (IIS 6.0) side. However, when I try to add a parameter with the following code:

Dim Week As CrystalDecisions.Web.Parameter
Week = New CrystalDecisions.Web.Parameter
Week.Name = "Week"
Week.DefaultValue = "1"
ReportDataSource.Report.Parameters.Add(Week)

It works fine on the development or my local copy but when I publish it to the web server it says:
"The report you requested requires further information"
It then throws up a generic authentication screen, with the sql servers name in the server name box.
The page has a box for the database name but it is empty, and even after authenticating numerous times as the sql account that we are using it does not change its mind.
I am not seeing any error on the application log.

Any ideas?

Avatar of Mike McCracken
Mike McCracken

Are you trying to add a new parameter to the report at runtime?

mlmcc
Avatar of jpwallen

ASKER

No; I am trying to supply a parameter to the report at runtime. The report already has the parameter set up if that is what you are asking.
Check this document.  The parameter passing starts on page 148.
http://www.businessobjects.com/global/pdf/dev_zone/VS2005_Walkthroughs.pdf

It may also be you are missing a dll.  Check the installation setups starting on page 434

mlmcc

Can you not use the SetParameter function? Also, try by supplying the login information programmatically to the report. You would need to use the ApplyLogonInfo for each table used in the report.
I have tried the SetParameterValue and tried programmatically setting the logon info for each table in the report. The report works fine on the local development copy but when I publish it to the production site the report fails. The crystal reports book describes the "wrong" way to use crystal reports in ASP.net. Our company has been using the way of creating a crystal reports document programmatically and setting a report viewers datasource to that, and it fills up the cache rather quickly. After about 60 reports are ran the cacle overflows and we are forced to recycle the application pool. I think this has to do with the reports not closing and disposing themselves after they have been used. I have found that the correct way of running reports in ASP.net is to use the CrystalReportsDataSource control which has a cache expiration timer built in. Any other ideas?

The crystal reports that we are using uses an ADO.net connection to SQL and a specific username and password.
ASKER CERTIFIED SOLUTION
Avatar of jpwallen
jpwallen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial