Solved

Crystal report fails when programmatically adding parameters.

Posted on 2008-09-30
7
380 Views
Last Modified: 2008-10-08
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?

0
Comment
Question by:jpwallen
  • 3
  • 3
7 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 22611015
Are you trying to add a new parameter to the report at runtime?

mlmcc
0
 
LVL 1

Author Comment

by:jpwallen
ID: 22613334
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.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 22614286
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

0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 83

Expert Comment

by:CodeCruiser
ID: 22614569
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.
0
 
LVL 1

Author Comment

by:jpwallen
ID: 22626674
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.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 22626749
0
 
LVL 1

Accepted Solution

by:
jpwallen earned 0 total points
ID: 22635207
I figured this one out on my own. While looking at the tutorials for creating a crystal report in ASP.net for Visual Studio 2005, I seen that they did everything exactly like I did except they used an ODBC connection. So I created a new ODBC connection in my reports and reset the location of the old tables to the ODBC one and it works like a charm. Now, I recall that the ADO.net connection is flaky for some reason. I think it had to do with a schema problem. Nevertheless though; I had to create a ODBC connection on my computer to actually get it to work, and then create the exact same connection on the server. It also seems to be a little faster this way but that could just be me.

The tutorial I used was:
http://msdn.microsoft.com/en-us/library/ms227806%28VS.80%29.aspx
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now