?
Solved

Programmatically adding crystal report parameters in web page(ASP.NET)

Posted on 2007-11-20
9
Medium Priority
?
2,609 Views
Last Modified: 2013-11-26
I would like to add parameters to filter based on user's selection.  I have used a stored procedure to load the crystal report.  The parameter is the same as the input parameter used in the stored proc.  For some reason the report does not allow any parameter choosing option on the web page, while it executes just fine when I run the report by itself (as a Crystal report).  

Thanks,

SunDevil
0
Comment
Question by:SunDevilProgrammer
  • 5
  • 4
9 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 20325534
It should prompt for the stored procedure parameter.

Is the parameter simply for filtering?

Yes, you can pass parameters to the report from an ASP page.

Display the FIELD EXPLORER
Right Click PARAMETER
Click NEW
FIll in the form

Save it

CLick REPORT
CLICK SELECT EXPERT
Select the field
Select the comparison
Select the parameter

mlmcc
0
 

Author Comment

by:SunDevilProgrammer
ID: 20328430
I did all of that but still am not prompted for a value when I run the app.  I get the report for the same parameter value every time and does not allow me to chcange the parameter value.  The purpose of using a parameter seems to be lost.  I am assuming I have to programmatically include the parameter option.  Something like..."ParameterFields"  or something of the sort...

HELP!!
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 20330719
Do you have the report saved with data?
Open the report
Click FILE
Ensure SAVE DATA WITH REPORT is not checked.

Try hitting the REFRESH button on the viewer.

mlmcc
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:SunDevilProgrammer
ID: 20345929
I have done everything described and am now getting an error that says "List of Values Failure. Fail to get values. Cause of Error: [Length of parameter field current values must be less than or equal to the maximum value.]"

The DataType of the field i sVarchar2(15Byyte) and I have no way to modify this.

Thanks
SunDevil
0
 

Author Comment

by:SunDevilProgrammer
ID: 20346122
Also, I would liek to mention here that although the parameter, when set to be Dynamic, produces the said error, but when set to Static, works just fine.  But I would like for the parameter field to get populated from the database and not let the user type in the values.

Woudl I be able to do it using VB code in the ASP page?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 20346463
If you want it to be populated from the database you have to ensure all values in the database match the parameter type.

mlmcc
0
 

Author Comment

by:SunDevilProgrammer
ID: 20346639
The dtabase has a VARCHAR2 datatype, but the only equivalent datatype in the parameter definition form is the String.  Is this what you are referring to?  Also, I noticed a snippet requiring to instantiate the report object as ..
Dim MyReport as new CrystalReport1
I want to know if "CrystalReport1" in this context is teh name of the report I created.  

I am sorry to be confused over an issue that is rather simple.  But the fact that this is so eluding tells it is not a simple problem anymore.  But with your help, it should be!

SunDevil

0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 20346784
Varchar is the same as string for Crystal.

CrystalReport1 is the object related to your report when you bring it into the applicaiton.

mlmcc
0
 

Author Comment

by:SunDevilProgrammer
ID: 20355686
Code that worked:
In the Load event of the page...

Dim Report as New ReportDocument()
Report.Load("C:\Documents and Settings\MyReport")
Report.SetDatabaseLogon("username", password")
CrystalReportViewer1.ReportSource = Report

I still need clarification on SetParameterValue method.

Is it necessary to go through the process in the report creation phase and still declare programmatically or can you avoid setting it in the report and directly code in the code-behind page?

Thanks,

SunDevil
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

862 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