标题:vb.net水晶报表关闭事件????
只看楼主
huwengui
Rank: 3Rank: 3
等 级:论坛游侠
威 望:1
帖 子:166
专家分:158
注 册:2011-4-22
结帖率:83.33%
 问题点数:0 回复次数:0 
vb.net水晶报表关闭事件????

报表页面关闭时触发某个事件,释放报表资源。
释放对象为Dim rd As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
rd.Close()

Dim rd As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
            Dim path1 As String = Server.MapPath("~/" + XiTongName + "/UTARpt/" + ReportName + ".rpt")
            rd.Load(path1)
            Dim ReportTime As String = Session("ReportTime")
            Dim path2 As String = Server.MapPath("~/ReportMdb/" + ReportName + Account + ReportTime + ".mdb")
            Dim connectionstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path2
            Dim conn As New OleDbConnection(connectionstring)
            Dim sqlcx() As String = Session("sql")
            Dim TableName() As String = Session("Table")
            Dim rpttablename() As String = Session("rpttablename")
            Dim ds As New DataSet()
            Dim n As Integer
            For n = 0 To sqlcx.Length - 1
                If sqlcx(n) = "" Then
                    Continue For
                End If
                Dim da As New OleDbDataAdapter("select * from " + TableName(n), conn)
                da.Fill(ds, rpttablename(n))
            Next
            Dim da1 As New OleDbDataAdapter("SELECT * FROM ReportCustomerInfo", conn)
            da1.Fill(ds, "ReportCustomerInfo")
            rd.SetDataSource(ds)
            rd.Database.Tables(0).SetDataSource(ds.Tables(0))
            conn.Close()
            conn.Dispose()
            CrystalReportViewer1.ReportSource = rd
        End If (最后要释放的即为CrystalReportViewer1.ReportSource = rd这个rd)
搜索更多相关主题的帖子: 资源 水晶 
2012-08-13 15:21



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-377200-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.253494 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved