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
Before in my vb app I would just load the icons from dll. How can I load the icons provided by .net dynamically?
How to connect crystal report in vb.net ?
Name some different types of control?
What is jagged array in vb.net?
what is common language specification?
What is the difference between manifest and metadata?
What is late binding and early binding?
How many classes a dll can contain?
Name a feature which is common to all .net languages?
What is the use of internal keyword?
List the different types of assembly?
What are the difference between dispose(), close(), exit(), end()? When do we use them?
What are the parts of the visual basic control?
What are the various open source tool available for VB.NET?
Explain the advantages of migrating to vb.net?