Lars Lindgren

Hi!

I have a very strange problem in Visual Studio 2005 with Crystal Reports. I have converted a project containing CR reports to VS 2005 from VS 2003. The project has worked well without no problems in VS 2003, but when I converted it to VS 2005, I get the following error when I try to export a CR report to PDF. The error message is as follow:

"An exception of type 'CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException' occurred in CrystalDecisions.ReportAppServer.DataSetConversion.dll but was not handled in user code

Additional information: Missing parameter values."

I have no clue what the problem is. All parameters that are available in the Parameter Fields tree node in the CR field explorer have been set, and have always been. The only one left is the Database field that is an XSD object. That one is also set using the SetDataSource. What can be missing It is working in VS 2003, but not here.

The strange thing is that I have a lot of exactly the same export methods that are working in VS 2005, but with this AccountReport it is not. Anyone has a clue of what can be wrong Some code examples below.

Thanks in advance!

Best regards
Lars

Public Sub WriteReportToPDFFile(ByVal path As String, ByVal dsNumbersOutput As dsNumbers)
Dim report As New AccountReport
Dim discretevalue As New CrystalDecisions.Shared.ParameterDiscreteValue

discretevalue.Value = Me.Param1
report.SetParameterValue(
"param1", discretevalue)
discretevalue =
New CrystalDecisions.Shared.ParameterDiscreteValue
discretevalue.Value =
Me.Param2
report.SetParameterValue(
"param2", discretevalue)
discretevalue =
New CrystalDecisions.Shared.ParameterDiscreteValue
discretevalue.Value =
Me.Param3
report.SetParameterValue(
"param3", discretevalue)
discretevalue =
New CrystalDecisions.Shared.ParameterDiscreteValue
discretevalue.Value =
Me.Param4
report.SetParameterValue(
"param4", discretevalue)
discretevalue =
New CrystalDecisions.Shared.ParameterDiscreteValue
discretevalue.Value =
Me.Param5
report.SetParameterValue(
"param5", discretevalue)

accountingreport.SetDataSource(dsNumbersOutput)

ExportToPDF(report, path)
End Sub

Private Sub ExportToPDF(ByVal report As CrystalDecisions.CrystalReports.Engine.ReportDocument,
ByVal path As String)
Dim diskoptions As New CrystalDecisions.Shared.DiskFileDestinationOptions

report.SetDatabaseLogon(userId, password)
diskoptions.DiskFileName = path

With report
.E
xportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
.ExportOptions.DestinationOptions = diskoptions
.Export()
End With

report.Close()
End Sub



Re: Crystal Reports for Visual Studio Missing parameter error in VS 2005 but not in VS 2003

Rox TW

Hi,

I have the same problem in Visual Studio 2005 with Crystal Reports,

I try to SetDataSource before define Parameter Fields, and this seem to work :

    Dim report As New AccountReport

    report.SetDataSource(dsNumbersOutput) 

   Dim discretevalue As New CrystalDecisions.Shared.ParameterDiscreteValue

    discretevalue.Value = Me.Param1
    report.SetParameterValue("param1", discretevalue)
    discretevalue = New CrystalDecisions.Shared.ParameterDiscreteValue
    discretevalue.Value = Me.Param2
    report.SetParameterValue("param2", discretevalue)
    discretevalue = New CrystalDecisions.Shared.ParameterDiscreteValue
    discretevalue.Value = Me.Param3
    report.SetParameterValue("param3", discretevalue)
    discretevalue = New CrystalDecisions.Shared.ParameterDiscreteValue
    discretevalue.Value = Me.Param4
    report.SetParameterValue("param4", discretevalue)
    discretevalue = New CrystalDecisions.Shared.ParameterDiscreteValue
    discretevalue.Value = Me.Param5
    report.SetParameterValue("param5", discretevalue)

    ExportToPDF(report, path)

Best regards

Rox / Taiwan





Re: Crystal Reports for Visual Studio Missing parameter error in VS 2005 but not in VS 2003

Srivatsa

Guys even im experiencing the same issue in my project.Please help me incase u've already found a solution for above

srivatsahg@gmail.com

srivatsahg@hotmail.com

Thanks

Srivatsa





Re: Crystal Reports for Visual Studio Missing parameter error in VS 2005 but not in VS 2003

texag

I fixed this (or a very similar problem that throws the same exception) with an internal application I am supporting/developing. My application "pulls" data into CR via stored procedures. If you are "pushing" your data into CR, see my comment at the end of this post. In my case, the VS2005 version of the application needed a fully qualified stored procedure name in the Location property of the CR Table object even though that property is internally set by Crystal Reports classes when they instantiated. Why this is related to missing parameters is a mystery to me...

I fixed this problem by suppling a complete name to the Location property (stored procedure/table name) of my CR Table object. I added the line (in bold) to my connection info setup method as follows:

Try
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

For Each tbCurrent In rpt.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
tliCurrent.ConnectionInfo.ServerName = GlobalData.DSNName
tliCurrent.ConnectionInfo.UserID = GlobalData.UserID
tliCurrent.ConnectionInfo.DatabaseName = GlobalData.DatabaseName
tliCurrent.ConnectionInfo.Password = GlobalData.UserPassword
tbCurrent.ApplyLogOnInfo(tliCurrent)
tbCurrent.Location = "dbo." + tbCurrent.Location.Substring(tbCurrent.Location.LastIndexOf(".") + 1)
Next
Catch ex As Exception
ErrorHandler.DisplayErrorMessage(ex)
End Try


The Location Property *must* be fully qualified (you may need to pre-pend the database name as well). In my case, Location changed from spGetData (in VS2003) to dbo.spGetData (in VS2005).

Possible fix if you are pushing data via the SetDataSource() method:

If you are pushing data into CR then make sure that you push your dataset into the report (SetDataSource()) prior to setting up your report parameters. If you call SetDataSource() after setting up your parameters you will likely see the Missing Parameter Values exception in VS2005.

Kevin





Re: Crystal Reports for Visual Studio Missing parameter error in VS 2005 but not in VS 2003

tireddad

Thank you so much for providing the solution to a very frustrating stumbling block.
There is now hope.




Re: Crystal Reports for Visual Studio Missing parameter error in VS 2005 but not in VS 2003

levirtuose

setDataSource before SetParameterValue

and it will work

Good look

Robert