问题描述
我在水晶报表查看器页面加载事件中编写以下代码以显示报告。但是myReportDocument.Load(Server.MapPath(Reportname.rpt))此行需要花费太多时间才能加载。什么是pblm。我怎么能解决这个问题。我使用SAP水晶报告,ASP.net。
受保护的子Page_Load(ByVal发送者为对象,ByVal e As System.EventArgs)处理Me.Load
如果IsPostBack那么
CrystalReportViewer1.ReportSource =会话(报告)
结束如果
Dim myReportDocument As New ReportDocument
Dim strCmd As String =
Dim ds作为New DataSet()
Dim SqlConn =新的SqlConnection(ConfigurationManager.ConnectionStrings(cnDB)。ConnectionString)
SqlConn.Open()
Dim dCmd作为新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
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
推荐答案
这篇关于花费太多时间在水晶报告中加载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!