Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.Net 2.0 / Visual Studio 2005 / Crystal Reports / Parameters

Posted on 2006-07-17
4
Medium Priority
?
4,661 Views
Last Modified: 2008-01-09
I have a web form with 1 text field and a button.  When I input criteria in the text field and click the button I get a "missing parameter values" message.  I'm calling the parameters before I open the report so I'm not sure why I'm getting this message.  I have EnableParameterPrompt set to 'False'.  If I set it to 'True', I get "The report you requested requires further information".  Any suggestions?  Thanks!
___________________________________________________________________________________________
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

'Connect to non-secured Access database

        Dim crDatabase As Database
        Dim crTables As Tables
        Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
        Dim crTableLogOnInfo As TableLogOnInfo
        Dim crConnectionInfo As ConnectionInfo
        Dim crReport As New ReportDocument()
        crReport.Load(Server.MapPath("CrystalReport2.rpt"))

        crConnectionInfo = New ConnectionInfo()

        With crConnectionInfo
            .ServerName = "c:\CR.mdb"
        End With

        crDatabase = crReport.Database
        crTables = crDatabase.Tables

        For Each crTable In crTables
            crTableLogOnInfo = crTable.LogOnInfo
            crTableLogOnInfo.ConnectionInfo = crConnectionInfo
            crTable.ApplyLogOnInfo(crTableLogOnInfo)
        Next

        Parameters()
        MyCrystalReportViewer.ReportSource = crReport
        Me.MyCrystalReportViewer.RefreshReport()

    End Sub

    Sub Parameters()
        ' Declare variables needed to pass the parameters
        ' to the viewer control.
        Dim paramFields As New ParameterFields()
        Dim paramField As New ParameterField()
        Dim discreteVal As New ParameterDiscreteValue()
        'Dim rangeVal As New ParameterRangeValue()

        ' The first parameter is a discrete parameter with multiple values.

        ' Set the name of the parameter field, this must match a
        ' parameter in the report.
        paramField.ParameterFieldName = "FY"

        ' Set the first discrete value and pass it to the parameter
        discreteVal.Value = FY1.Text

        paramField.CurrentValues.Add(discreteVal)

        paramFields.Add(paramField)

        ' Set the parameter fields collection into the viewer control.
        MyCrystalReportViewer.ParameterFieldInfo = paramFields

    End Sub
0
Comment
Question by:drees727
[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
  • 2
  • 2
4 Comments
 
LVL 42

Accepted Solution

by:
frodoman earned 500 total points
ID: 17125113
Try commenting out this line:

   Me.MyCrystalReportViewer.RefreshReport()


The RefreshReport method refreshes your entire report - essentially invalidating all of the information you just supplied to the report.  When you set the report source of the viewer (  MyCrystalReportViewer.ReportSource = crReport ) the databinding happens automatically so there's no need for your RefreshReport code.

frodoman
0
 

Author Comment

by:drees727
ID: 17125195
I tried commenting out Me.MyCrystalReportViewer.RefreshReport() but it doesn't seem to be recognizing my database connection to nt non-secured Access database.  Now I'm getting:

The report you requested requires further information.
--------------------------------------------------------------------------------
  c:\CR.mdb  
Server name:    
Database name:    
User name:    
Password:    
 Use Integrated Security  

If I remove the 'Parameters()' line in Sub Button1_Click, I don't get the above message but I get the 'missing parameter values' message.
0
 

Author Comment

by:drees727
ID: 17125264
Nevermine my last post.  I forgot to change the database path before moving from development to production.  Your suggestion to remove RefreshReport() solved my problem.  Thanks for the help!!
0
 
LVL 42

Expert Comment

by:frodoman
ID: 17125389
Glad to help.
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

618 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