Solved

Crystal report viewer and ASP.NET 2.0

Posted on 2008-10-20
10
682 Views
Last Modified: 2010-05-18
What I would like to do is to open a report I created in Crystal  report thru ASP.NET page.
The report I created has a stored procedure and has to pass  2 parameters- Yeardate and CustomerID.
In the page I  have both of the pareameters stored in variables. I would like to make this dynamic as I change to the valued of teh parameters , it would display it accordingly in the report.
My question is how would I apply those variables to tthe Crystal report  using that page. I do not want the user to be prompted to type the yeardate and custumerID. Im kind of stump on this. thanks.
Im looking for code /ecample on specifically connecting variables from an asp.net page(vb.net) to pass the parameters to to Crystal
0
Comment
Question by:zachvaldez
[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
  • 6
  • 4
10 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 22767534
Check this document
Starting on page 16 is a walkthrough on running a report with parameters

http://www.businessobjects.com/global/pdf/dev_zone/VS2005_Walkthroughs.pdf

mlmcc
0
 

Author Comment

by:zachvaldez
ID: 22773041
Thanks,
   I went thru this, but I'm having difficulty in passing 2 parameters (pg 20-25). The earlier pages had great example, however, when I apply it to my scenario, I m prompted with a page that is asking for the parameters.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 22773508
WHat code do you have for 1 parameter?

mlmcc
0
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!

 
LVL 100

Expert Comment

by:mlmcc
ID: 22773509
0
 

Author Comment

by:zachvaldez
ID: 22778134
Here;'s code as I followed the walkthrough. hope it helps

Private Const PARAMETER_PROC_LEVEL As String = "@LIT">> this is the name of the parameter
        Dim myarraylist As ArrayList = New ArrayList()
         myarraylist.Add(sid)
        Dim reportpath As String = Server.MapPath("Reports/Term.rpt")

        RptViewer.ReportSource = reportpath
        Dim myParameterFields As ParameterFields = RptViewer.ParameterFieldInfo
  'Note everything seems OK to this point until I call this....
        SetCurrentValuesForParameterField(myParameterFields, myarraylist)


    Private Sub SetCurrentValuesForParameterField(ByVal myParameterfields As  ParameterFields, ByVal myArraylist As ArrayList)
        Dim currentparametervalues As ParameterValues = New ParameterValues()
     
        For Each submittedvalue As Object In myArraylist
            Dim myParameterDiscretevalue As ParameterDiscreteValue = New                           ParameterDiscreteValue()
               myParameterDiscretevalue.Value = submittedvalue.ToString()
                   currentparametervalues.Add(myParameterDiscretevalue)
                  Next
        Dim myParameterField As ParameterField = myParameterfields(PARAMETER_PROC_LEVEL)>>>
           'Here I got the error "Specified argument was out of the range of valid values"
                myParameterField.CurrentValues = currentparametervalues
           End Sub
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 22779450
Does it work?

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 22779488
Sorry missed the error line in my first look.

What is Parameter_PROC_LEVEL

mlmcc
0
 

Author Comment

by:zachvaldez
ID: 22782948
The example shows to create a constant .. IN this case,  the "@LIT" is the parameter pass in Crystal..
thanks
0
 

Author Comment

by:zachvaldez
ID: 22847670
the example walkthorugh  which I find difficulty following it.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 300 total points
ID: 22852445
I agree the walkthrough is difficult.  I don't have VS to work with otherwise I would build the code and be able to just show that,

This link shows how to pass a parameter at the end of the article

http://www.emoreau.com/Entries/Articles/2006/09/Feeding-Crystal-Reports-from-your-application.aspx

mlmcc
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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