Ошибка Crystal Report Параметр отсутствует при попытке открыть в VS 2013, но работает нормально в VS 2008 и 2005 - PullRequest
0 голосов
/ 01 января 2019

Я конвертирую проект VS 2005 в VS 2013, все работает нормально, но Crystal Report выдает ошибку «Missing Parameter», все отчеты работают нормально в VS 2005, но выдает ту же ошибку Missing Parameter в VS 2013

Here is my Code
  Dim crReportDocument As 
 CrystalDecisions.CrystalReports.Engine.ReportDocument
Private Sub OpenReport(ByVal rName As String)
    ClientScript.RegisterStartupScript(Me.Page.GetType(), "popupOpener", 
     "var popup=window.open('" + rName.ToString + 
   "','','width=768,height=715,resizable=yes,menubar=0,
    scrollbars=yes,top=0,left= 
     0');popup.focus();", True)
    End Sub
Private Sub GetReport(ByVal DocumentNo As String, ByVal FromDocumentDate As 
  String, ByVal ToDocumentDate As String, ByVal ReportType As String)


    Dim sParameter(2) As String
    Dim sParameterValue(2) As String
    Dim NewDocumentNo() As String = DocumentNo.Split("|")
    Dim NewFromDocumentDate() As String = FromDocumentDate.Split("|")
    Dim NewToDocumentDate() As String = ToDocumentDate.Split("|")

    DocumentNo = ""
    FromDocumentDate = ""
    ToDocumentDate = ""

    For i = 0 To NewDocumentNo.Length
        If i <> NewDocumentNo.Length Then
            If NewDocumentNo.Length = 1 Then
                DocumentNo = "'" & NewDocumentNo(i) & "'"
                FromDocumentDate = "'" & NewFromDocumentDate(i) & "'"
                ToDocumentDate = "'" & NewToDocumentDate(i) & "'"
            Else
                DocumentNo = DocumentNo & "'" & NewDocumentNo(i) & "'" & ","
                FromDocumentDate = FromDocumentDate & "'" & NewFromDocumentDate(i) & "'" & ","
                ToDocumentDate = ToDocumentDate & "'" & NewToDocumentDate(i) & "'" & ","
            End If
        End If
    Next

    If NewDocumentNo.Length > 1 Then
        DocumentNo = Left(DocumentNo, DocumentNo.LastIndexOf(","))
        FromDocumentDate = Left(FromDocumentDate, FromDocumentDate.LastIndexOf(","))
        ToDocumentDate = Left(ToDocumentDate, ToDocumentDate.LastIndexOf(","))
    End If
    sParameterValue(1) = " Where C.Transaction_No <> 0 And A.Document_No IN (" & DocumentNo & ")"




    Dim rName As String
    Dim _Report As New rptObject
    crReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument

    Select Case ReportType
        Case "Cheque"
            rName = "rptCheque"
            crReportDocument.Load(Server.MapPath("../Reports/" + rName + ".rpt"))
            With _Report
                .AddParameter("@WhereCond", sParameterValue(1), crReportDocument)
            End With
            'Case "ITXJournal"
            '    rName = "rptITXJournalVoucher"
            '    crReportDocument.Load(Server.MapPath("../Reports/" + rName + ".rpt"))
            '    With _Report
            '        .AddParameter("User Name", Session("UserName"), crReportDocument)
            '        .AddParameter("@WhereCond", sParameterValue(1), crReportDocument)
            '    End With
            'Case "ITXCashPaymemt"
            '    rName = "rptITXTransactionDetail"
            '    crReportDocument.Load(Server.MapPath("../Reports/" + rName + ".rpt"))
            '    With _Report
            '        .AddParameter("User Name", Session("UserName"), crReportDocument)
            '        .AddParameter("@WhereCond", sParameterValue(1), crReportDocument)
            '    End With
            'Case "Journal"
            '    rName = "rptJournalVoucher"
            '    crReportDocument.Load(Server.MapPath("../Reports/" + rName + ".rpt"))
            '    With _Report
            '        .AddParameter("User Name", Session("UserName"), crReportDocument)
            '        .AddParameter("@WhereCond", sParameterValue(1), crReportDocument)
            '    End With
        Case Else
            rName = "rptGLTransactionDetail"
            ''  rName = "GLReport"
            crReportDocument.Load(Server.MapPath("../Reports/" + rName + ".rpt"))
            With _Report
                .AddParameter("UserName", Session("UserName"), crReportDocument)
                .AddParameter("CompanyName", Session("CompanyName"), crReportDocument)
                .AddParameter("VoucherHeading", "Heading", crReportDocument)
                .AddParameter("@WhereCond", sParameterValue(1), crReportDocument)
            End With
    End Select

    crReportDocument.DataSourceConnections.Item(0).SetConnection("KT", "JVC", True)
    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
#End Region    

Когда-нибудь отчет запускается, но не принимает параметры и показывает все записи, а иногда выдает ошибку. Отсутствует параметр

...