p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Crystal Reports for VS.NET (http://p2p.wrox.com/forumdisplay.php?f=45)
-   -   how to view crystal report in asp.net (http://p2p.wrox.com/showthread.php?t=41759)

bhaveshsanghani April 26th, 2006 04:52 AM

how to view crystal report in asp.net
how to view crystal report without database password prompting in asp .net 2.0

Bhavesh Sanghani

hrothenb October 26th, 2014 12:10 AM

how to view crystal report in asp.net vb


Imports CrystalDecisions
Imports CrystalDecisions.CrystalReports
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.IO

Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub

    Protected Sub LinkButton1_Click(sender As Object, e As EventArgs) Handles LinkButton1.Click

        OpenPDF(Request.ApplicationPath + "/Reports/Report.pdf")

    End Sub

    Private Sub OpenPDF(downloadAsFilename As String)
        Dim RptDoc As New ReportDocument()
        RptDoc.Load(Server.MapPath(Request.ApplicationPath + "/Reports/myreport.rpt"))
        RptDoc.SetDatabaseLogon("user", "password", "server", "database")

        Dim stream As New BinaryReader(RptDoc.ExportToStream(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat))
        Response.ContentType = "application/pdf"
        Response.AddHeader("content-disposition", Convert.ToString("attachment; filename=") & downloadAsFilename)
        Response.AddHeader("content-length", stream.BaseStream.Length.ToString())
    End Sub
End Class

All times are GMT -4. The time now is 04:00 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.