on 03-02-2015 5:06 PM
Hi everyone,
I have an ASP VB.NET web application developed in Visual Studio 2010 4.0 loaded on server A making a call to server B running Crystal reports 2013. I want to use the same Viewer and use Case to pass the name of the report. But I can’t Dispose of the document I am getting an error: Public member 'Dispose' on type 'ISCDReportClientDocument' not found. I would appropriate any help on this one because I am stuck.
Here is my code:
Public Class GLReports
Inherits System.Web.UI.Page
Private boEnterpriseSession As EnterpriseSession
Private boInfoObject As InfoObject
Private boReportClientDocument As ReportClientDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("UserID") Is Nothing Then Response.Redirect("..\Login.aspx")
Dim blnIsError As Boolean = False
Try
Dim boSessionMgr As SessionMgr
Dim boInfoStore As InfoStore
Dim boEnterpriseService As EnterpriseService
Dim boInfoObjects As InfoObjects
Dim boReportName As String = Request("FormName")
Dim boQuery As String
Dim boReportAppFactory As ReportAppFactory
If Session("boEnterpriseSession") IsNot Nothing Then
boEnterpriseSession = DirectCast(Session("boEnterpriseSession"), EnterpriseSession)
Else
boSessionMgr = New CrystalDecisions.Enterprise.SessionMgr()
boEnterpriseSession = boSessionMgr.Logon("username ", " password ", " cms ", " authtype ")
Session.Add("boEnterpriseSession", boEnterpriseSession)
End If
If Session("boReportClientDocument") IsNot Nothing Then
boReportClientDocument = DirectCast(Session("boReportClientDocument"), ReportClientDocument)
Else
boEnterpriseService = boEnterpriseSession.GetService("", "InfoStore")
boInfoStore = New CrystalDecisions.Enterprise.InfoStore(boEnterpriseService)
Select Case boReportName
Case "Test1"
boReportName = "rptTest1.rpt"
Case "Test2"
boReportName = " rptTest2.rpt "
End Select
boQuery = "Select Query"
boInfoObjects = boInfoStore.Query(boQuery)
boInfoObject = boInfoObjects(1)
boEnterpriseService = Nothing
'Retrieve the RASReportFactory
boEnterpriseService = boEnterpriseSession.GetService("RASReportFactory")
boReportAppFactory = DirectCast(boEnterpriseService.[Interface], CrystalDecisions.ReportAppServer.ClientDoc.ReportAppFactory)
'Open the report from Enterprise
boReportClientDocument = boReportAppFactory.OpenDocument(boInfoObject.ID, 0)
'Add the reportClientDocument to session
Session.Add("boReportClientDocument", boReportClientDocument)
End If
'Set the ReportSource of the viewer to the report in Session
CRViewer.ReportSource = Session("boReportClientDocument")
boReportClientDocument.Close()
boReportClientDocument.Dispose()
Catch ex As Exception
blnIsError = True 'if any error occured then no need to udpate the batch status
lblMessage.Text = "Error, " & ex.Message
lblMessage.ForeColor = System.Drawing.ColorTranslator.FromHtml("Red")
cGeneral.WriteLog(ex)
End Try
End Sub
End Class
Hi Milena,
The report is in session so you don't want to dispose of it. Only when you are done with the report then close it and dispose.
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.