?
Solved

Passing parameters to report

Posted on 2003-02-19
3
Medium Priority
?
1,181 Views
Last Modified: 2012-06-21
I'm using ASP to call  a report which use a stored procedure with a single parameter.
Here's what i'm doing
dim fileName,ObjectFactory,ReportAppSession,HTMLViewer,ReportClientDocument,OpenReport
   fileName = Server.MapPath(Request.QueryString("ReportName"))
     response.Write fileName
   Set ObjectFactory = Server.CreateObject("CrystalReports.ObjectFactory.2")
    Set ReportAppSession = ObjectFactory.CreateObject("CrystalReports.ReportAppSession")
   Set HTMLViewer = ObjectFactory.CreateObject("CrystalReports.CrystalReportViewer")
   Set ReportClientDocument = ReportAppSession.CreateService("CrystalReports.ReportClientDocument")

   HTMLViewer.EnableParameterPrompt = false
   HTMLViewer.EnableLogonPrompt = false
   HTMLViewer.IsOwnPage = true
   HTMLViewer.URI = "pageviewer-new.asp?ReportName=" + Server.URLEncode(fileName)

   ReportClientDocument.Open fileName
   Set OpenReport = ReportClientDocument

   For Each Field in OpenReport.DataDefinition.ParameterFields
       
        Set paramToChange = Field
         
       Set parameterFieldDiscreteValue = ObjectFactory.CreateObject("CrystalReports.ParameterFieldDiscreteValue")
       parameterFieldDiscreteValue.Value = CStr(Request.QueryString(paramToChange.Name))
         
       Set parameterField = ObjectFactory.CreateObject("CrystalReports.ParameterField")
       paramToChange.CopyTo parameterField
       parameterField.CurrentValues.Add(parameterFieldDiscreteValue)
       Set parameterFieldController = OpenReport.DataDefController.ParameterFieldController
       parameterFieldController.Modify paramToChange, parameterField

   Next
   OpenReport.DatabaseController.Logon "UID","PWD"

   HTMLViewer.ReportSource = OpenReport

   HTMLViewer.ProcessHttpRequest Request, Response

 
it gives me an error "The parameter is incorrect
webReporting.dll error '80070057'  
" at line 38 which is the last statement " HTMLViewer.ProcessHttpRequest Request, Response"

Any ideas?
0
Comment
Question by:primo007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 300 total points
ID: 7983965
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

801 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