[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 719
  • Last Modified:

Vb.net2005 Crystal report error

have a crystal report that is opened via a web application using vb.net 2005.  The problem we are seeing is that occasionally if a user has a session open and a new user initiates a session.  The second user will get the report with the first users information.  Does anyone know why this would happen? My code is shown below

 

Try
                oRep = New ReportDocument
                Response.Clear()
                Response.Charset = "" 
                Response.ClearContent()
                Response.ClearHeaders()
                Response.ContentType = "application/pdf"
                ExportDirectory = New ExportOptions

                oRep.Load(strPath)
                oRep.SetDatabaseLogon("XXX", "XXXX")
                oRep.Refresh()
                oRep.SetParameterValue("@VAR1", VAR1)
                oRep.SetParameterValue("@VAR2", VAR2)
                oRep.SetParameterValue("@VAR3", VAR3)

                ExportDirectory = oRep.ExportOptions
                ExportDirectory.ExportFormatType = ExportFormatType.PortableDocFormat
                oRep.ExportToHttpResponse(ExportDirectory, Response, False, "rpt1")
       
        Catch ex As System.Exception


        Finally

            If Not IsNothing(oRep) Then
                Response.Flush()
                Response.Close()
                oRep.Close()
                oRep.Dispose()
                GC.Collect()
            End If

        End Try
0
kasejust1993
Asked:
kasejust1993
  • 2
1 Solution
 
mlmccCommented:
The only thing that makes sense is that he is opening the first users PDF.

You might try using the user name or some other unique value as part of the pdf file name.

mlmcc
0
 
kasejust1993Author Commented:
How can I dynamically name the report?
0
 
mlmccCommented:
oRep.ExportToHttpResponse(ExportDirectory, Response, False, "rpt1" & CStr(CurrentTime))

Replace the CStr(CurrentTime) with the users login.

mlmcc
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now