Solved

Problem sharing crystal report on the web

Posted on 2007-11-14
3
262 Views
Last Modified: 2012-06-21
I am using the following code to create a crystal reports that shows up in a web browser as a pdf. file.  Works great.  Except for the fact that its a web program and when I try and have mulitple people get a report, It must be creating the same temp pdf or something, cause It says the file is being used by another process.   Can someone look at the code below and figure out how to fix this problem.  Thanks

crDiskfilelocation = New DiskFileDestinationOptions
        Fname = ConfigurationSettings.AppSettings("ReportPath") & Session.SessionID.ToString & ".pdf"
        crDiskfilelocation.DiskFileName = Fname
        crExportOptions = crReport.ExportOptions
        With crExportOptions
            .DestinationOptions = crDiskfilelocation
            .ExportDestinationType = ExportDestinationType.DiskFile
            .ExportFormatType = ExportFormatType.PortableDocFormat
        End With
        crReport.Export()
        System.Diagnostics.Process.Start(Fname)
        'crViewer.ReportSource = crReport
        'crViewer.PrintMode = CrystalDecisions.Web.PrintMode.Pdf
        Response.ClearContent()
        Response.ClearHeaders()
        Response.ContentType = "application/pdf"
        Response.WriteFile(Fname)
        Response.Flush()
        Response.Close()
0
Comment
Question by:mgmhicks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 20284344
Not sure how to di it in .Net but in VB6 we had to cleanup the report objects.

Set crReprot = Nothing

Which edition of Crystal do you have?  

How did you install it on the web server?

mlmcc
0
 
LVL 4

Accepted Solution

by:
stcindia earned 500 total points
ID: 20287891
May be you can directly write to memorystream and send to the browser so no need to specify file name

Below is partial sample code

                Dim mem As MemoryStream
                mem = crReport.ExportToStream(ExportFormatType.PortableDocFormat)
                Response.Clear()
                Response.Buffer = True
                Response.ContentType = "application/pdf"
                Response.BinaryWrite(mem.ToArray)
                Response.End()
0
 

Author Comment

by:mgmhicks
ID: 20289258
You  are the man.  Worked like a champ.  thank you stcindia:
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question