on 03-26-2009 2:01 PM
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
myReportDocument.Load(sReport)
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
Next
Me.CrystalReportViewer1.EnableDatabaseLogonPrompt = False
If myReportDocument.ParameterFields.Count > 0 Then
Me.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.ParameterPanel
Else
Me.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None
End If
Else
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
Hey Bobby,
You are storing the report in session, and opening more than one window. This is probably causing the second report open to overwrite the first. The parameter information is stored in viewstate. So it is applying the wrong parameter information to the wrong report.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your response. Based on the information in my original post, I recognize what is happening. I was looking for an example of how to fix the issue. I was hoping someone would have a good example of how they run multiple reports from an ASP application. Specifically the code used to create the session information.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.