Skip to Content
Former Member
Mar 26, 2009 at 02:01 PM

Parameter is Incorrect Error on ASP page


When running reports form my ASP page the reports will run fine and display. However if I leave the first report open and run another report and then go back and click on the first report I get an error. The error is "The parameter is incorrect". I know what is happening but don't know how to keep if from occuring.

The problem is that both reports on the client are pointing to the same report in memory on the server.

My Page_load code is as follows

If Not Page.IsPostBack or Session("rptDoc") is nothing Then
      Dim sReport As String = Server.UrlDecode(Request.QueryString("Report"))
      Dim sGroup As String = Server.UrlDecode(Request.QueryString("Group"))

      'Create the Report object and create a session variable.  Used on postback
      myReportDocument = New ReportDocument
      Session("rptDoc") = myReportDocument
      CrystalReportViewer1.ReportSource = myReportDocument

      Dim myconn As New ConnectionInfo
      Dim myTables As New TableLogOnInfos

      myTables = Me.CrystalReportViewer1.LogOnInfo

      Dim sConStr As String = ConfigurationManager.ConnectionStrings(sGroup).ConnectionString.ToString
      Dim sArr As String() = sConStr.Split(";")
      With myconn
        For i As Integer = 0 To sArr.Length - 1
          If sArr(i).Contains("Data Source") Then
            .DatabaseName = sArr(i).Substring(InStr(sArr(i), "="))
          End If
          If sArr(i).Contains("User") Then
            .UserID = sArr(i).Substring(InStr(sArr(i), "="))
          End If
          If sArr(i).Contains("Password") Then
            .Password = sArr(i).Substring(InStr(sArr(i), "="))
          End If
        Next i
      End With

      For Each tbl As TableLogOnInfo In myTables
        tbl.ConnectionInfo = myconn

      Me.CrystalReportViewer1.EnableDatabaseLogonPrompt = False
      If myReportDocument.ParameterFields.Count > 0 Then
        Me.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.ParameterPanel
        Me.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None
      End If
      myReportDocument = CType(Session("rptDoc"), ReportDocument)
      CrystalReportViewer1.ReportSource = myReportDocument
      'crReportDocument.ExportToDisk(ExportFormatType.CrystalReport, "C:\\Windows\\temp\\SampleReport.rpt");

    End If

I am certain it has to do with the session information. Any help would be greatly appreciated. We are trying to deploy to production this weekend!

Thanks, Bob