在Crystal Report中从VS 2008迁移到VS 2013后缺少参数错误

时间:2019-01-07 07:31:58

标签: crystal-reports crystal-reports-2008

我将我的项目从VS 2008迁移到VS 2013,一切正常,但是Crystal Report给出错误的Missing Parameters,当调试我的代码时,所有参数都从代码中传递出来,但是当通过错误“ Missing parameters”导出到dist时,我最近的Crystal报表版本是13.0.2000.0,而我的旧Crystal报表版本是10.5.3700.0

  Dim rName As String
    Dim _Report As New rptObject
    crReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
    Select Case ReportType
        Case "ACCOUNTS-CASHBANKBOOK"
            rName = "CashBankBookReport"
            crReportDocument.Load(Server.MapPath("../Reports/" + rName + ".rpt"))
            With _Report
                .AddParameter("User Name", Session("UserName"), crReportDocument)
                .AddParameter("CompanyName", Session("CompanyName"), crReportDocument)
                .AddParameter("@AccountCode", AccountCode, crReportDocument)
                .AddParameter("AccountTitle", AccountTitle, crReportDocument)
                .AddParameter("@DateFrom", DateFrom, crReportDocument)

                .AddParameter("DateTo", DateTo, crReportDocument)
                .AddParameter("@WhereCond", sParameterValue(6), crReportDocument)
                .AddParameter("@SortExpression", SortExpression, crReportDocument)
                .AddParameter("@AccountType", AccountType, crReportDocument)

                .AddParameter("ComputerName", Session("ComputerName"), crReportDocument)
                .AddParameter("@sysProject_Code", IIf(ProjectCode = "All", 0, ProjectCode), crReportDocument)
            End With
        Case Else
    End Select
    crReportDocument.DataSourceConnections.Item(0).SetConnection("KT", "JVC", True)
    rName = "CashBankBookReport"
    If cboReportFormat.SelectedValue.Equals("pdf") Then
        crReportDocument.ExportToDisk(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Server.MapPath("../Reports/" + rName + ".pdf"))
        'Call OpenReport(System.Web.HttpContext.Current.Server.MapPath("../Reports/" + rName + ".pdf"))
    Else
        crReportDocument.ExportToDisk(ExportFormatType.Excel, System.Web.HttpContext.Current.Server.MapPath("../Reports/" + rName + ".xls"))
        'Call OpenReport(System.Web.HttpContext.Current.Server.MapPath("../Reports/" + rName + ".xls"))
    End If
    OpenReport("../Reports/" + rName + "." + cboReportFormat.SelectedValue)
End Sub

0 个答案:

没有答案