Click here to Skip to main content
15,895,827 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am writing the following code in crystal report viewer page load event to show the report.but "myReportDocument.Load(Server.MapPath(Reportname.rpt))" this line take too much time to load.What's the pblm.How can I solved this pblm.I use SAP crystal report ,ASP.net.




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



If IsPostBack Then
CrystalReportViewer1.ReportSource = Session(report)
End If



Dim myReportDocument As New ReportDocument
Dim strCmd As String = ""
Dim ds As New DataSet()


Dim SqlConn = New SqlConnection(ConfigurationManager.ConnectionStrings("cnDB").ConnectionString)

SqlConn.Open()
Dim dCmd As New SqlCommand()
dCmd.Connection = SqlConn


strCmd = "SELECT * FROM Table" & Request.QueryString("strOption1")
Dim da = New SqlDataAdapter(strCmd, SqlConn)
da.Fill(ds, "Table")
myReportDocument.Load(Server.MapPath("Reportname.rpt"))

SqlConn.Close()

myReportDocument.SetDataSource(ds)

CrystalReportViewer1.HasCrystalLogo = False
CrystalReportViewer1.HasToggleGroupTreeButton = False
CrystalReportViewer1.HasToggleParameterPanelButton = False
CrystalReportViewer1.Zoom(100)
CrystalReportViewer1.ReportSource = myReportDocument
CrystalReportViewer1.DataBind()
CrystalReportViewer1.RefreshReport()
Session.Add("report", myReportDocument)




End Sub
Posted

1 solution

Check this answer, I have explained things on many topic to improve things.
How to improve performance of a website?[^]

Check Crystal reports optimization for your issue.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900