how to create crystal reports in asp.net & vb.net with
syntax
Answer Posted / howard rothenburg
Try:
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.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", Convert.ToString("attachment; filename=") & downloadAsFilename)
Response.AddHeader("content-length", stream.BaseStream.Length.ToString())
Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length)))
Response.Flush()
Response.Close()
End Sub
End Class
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is datatype conversion?
What are the various open source tool available for VB.NET?
What is an arraylist?
Explain the difference between datatable and dataset?
What is difference between import system.data.sqlclient,system.data.oledb?
What is a static class?
Which is the base class for all the classes in .net framework?
Explain the use of serialization and deserialization?
What are the advantages of migrating to vb.net?
Explain the difference between import system.data.sqlclient and system.data.oledb?
How do you call a stored procedure in Visual Basic?
What is the ruby interface generator?
Explain the difference between .dll extension and .exe extension files?
What is deep copy?
Explain strong name in .net assembly?