本文介绍了在VS 2005中缺少参数错误,但在VS 2003中没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 嗨!我在使用Crystal Reports的Visual Studio 2005中遇到了一个非常奇怪的问题。我已经将包含CR报告的项目从VS 2003转换为VS 2005.该项目在VS 2003中运行良好而没有任何问题,但是当我将其转换为VS 2005时,当我尝试将CR报告导出到以下时出现以下错误: PDF。错误消息如下所示: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:"CrystalDecisions.ReportAppServer.DataSetConversion.dll中发生了类型'CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException'的异常,但未在用户代码中处理"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."我不知道问题是什么。 CR字段资源管理器中的"参数字段"树节点中可用的所有参数都已设置,并且一直都是。剩下的唯一一个是数据库字段,它是一个XSD对象。那个也是使用SetDataSource设置的。有什么可以遗漏?它在VS 2003中工作,但不在这里。 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. 奇怪的是,我有很多完全相同的导出方法在VS 2005中工作,但是这个AccountReport却没有。任何人都有可能出错的线索?下面是一些代码示例。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.提前致谢!最好的问候 Lars Best regardsLars 公开 Sub WriteReportToPDFFile( ByVal path As String , ByVal dsNumbersOutput As dsNumbers) Dim report As 新 AccountReport Dim discretevalue As 新 CrystalDecisions.Shared.ParameterDiscreteValue 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 = 我 .Param1 report.SetParameterValue( " param1" ,discretevalue) discretevalue = 新 CrystalDecisions.Shared.ParameterDiscreteValue discretevalue.Value = Me .Param2 report.SetParameterValue( " param2" ,discretevalue) discretevalue = 新 CrystalDecisions .Shared.ParameterDiscreteValue discretevalue.Value = Me .Param3 report.SetParameterValue( " param3" ,discretevalue) discretevalue = 新 CrystalDecisions.Shared.ParameterDiscreteValue discretevalue。值= Me .Param4 report.SetParameterValue( " param4" ,discretevalue) discretevalue = 新 CrystalDecisions.Shared.ParameterDiscreteValue discretevalue.Value = Me .Param5 report.SetParameterValue ( " param5" ,discretevalue) accountingreport.SetDataSource(dsNumbersOutput)     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(报告,路径) 结束 Sub     ExportToPDF(report, path)End Sub Private Sub ExportToPDF(ByVal报告为CrystalDecisions.CrystalReports.Engine.ReportDocument, ByVal path As String) Dim diskoptions As 新 CrystalDecisions.Shared.DiskFileDestinationOptions report.SetDatabaseLogon(userId,password) diskoptions.DiskFileName = path 使用 report .E xportOptions.ExportDestinationType = CrystalDecisions。[Shared] .ExportDestinationType.DiskFile .ExportOptions.ExportFormatType = CrystalDecisions。[Shared] .ExportFormatType.PortableDocFormat .ExportOptions。 DestinationOpti ons = diskoptions .Export() 结束 With 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        .ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile        .ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat        .ExportOptions.DestinationOptions = diskoptions        .Export()    End With report.Close() End Sub     report.Close()End Sub 推荐答案 我在使用Crystal Reports的Visual Studio 2005中遇到了同样的问题,I have the same problem in Visual Studio 2005 with Crystal Reports, 我在定义 参数字段之前尝试使用SetDataSource,这似乎有效:I try to SetDataSource before define Parameter Fields, and this seem to work :      Dim report As 新帐户报告     Dim report As New AccountReport     report.SetDataSource(dsNumbersOutput)     Dim discretevalue As New CrystalDecisions.Shared.ParameterDiscreteValue    Dim discretevalue As New CrystalDecisions.Shared.ParameterDiscreteValue     discretevalue.Value = 我 .Param1     report.SetParameterValue("param1",discretevalue)    discretevalue = New CrystalDecisions.Shared.ParameterDiscreteValue     discretevalue.Value = 我 .Param2     report.SetParameterValue("param2",discretevalue)    discretevalue = New CrystalDecisions.Shared.ParameterDiscreteValue     discretevalue.Value = 我 .Param3     report.SetParameterValue("param3",discretevalue)    discretevalue = New CrystalDecisions.Shared.ParameterDiscreteValue     discretevalue.Value = 我 .Param4     report.SetParameterValue("param4",discretevalue)    discretevalue = New CrystalDecisions.Shared.ParameterDiscreteValue     discretevalue.Value = 我 .Param5     report.SetParameterValue("param5",discretevalue)     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(报告,路径) 最好的问候 Rox /台湾 Rox / Taiwan 这篇关于在VS 2005中缺少参数错误,但在VS 2003中没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-15 23:28