Solved

Problem sharing crystal report on the web

Posted on 2007-11-14
3
261 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Question has a verified solution.

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

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

830 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