Print Page | Close Window

.Net 2005 and Crystal Enterprise 10

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=1405
Printed Date: 02 May 2025 at 5:26pm


Topic: .Net 2005 and Crystal Enterprise 10
Posted By: dalden
Subject: .Net 2005 and Crystal Enterprise 10
Date Posted: 28 Sep 2007 at 3:47pm

Recently I was successful in retrieving a report from the crystal enterprise 10 server and display it on an asp.net 2.0 Page.  Certain reports (those with subreports I suspect) return an "Invalid Pointer" error to the viewer. 

Question 1:

How can I display these reports that have subreports

 

Question 2:

How can I replace the CrystalReportsViewer .Net Control with the ActiveX Viewer (Due to a customer's request)

My Code is as follows

**************.aspx********************

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb" Inherits="Default3" %>

<%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"

Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:ListBox ID="ListBox1" runat="server" Height="344px">

<!--List of Report Titles Go here-->
</asp:ListBox>

<asp:Button ID="Button1" runat="server" Text="Button" /><br />

<br />

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true">

</CR:CrystalReportViewer>

</div>

</form>

</body>

</html>

**************.aspx.vb********************

Imports CrystalDecisions.Enterprise

Imports CrystalDecisions.ReportAppServer.ClientDoc

Imports CrystalDecisions.Shared

Imports CrystalDecisions.Enterprise.Desktop

Imports CrystalDecisions.Enterprise.Viewing

Imports CrystalDecisions.ReportAppServer.Controllers

Imports CrystalDecisions.ReportAppServer

Partial Class Default3

Inherits System.Web.UI.Page

Dim ceSession As EnterpriseSession

Dim ceEnterpriseService As EnterpriseService

Dim ceInfoStore As InfoStore

Dim ceReportObjects As InfoObjects

Dim ceReportObject As InfoObject

Dim ceReport As Report

Dim sQuery As String

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim ceSessionMgr As SessionMgr = New SessionMgr

'logon to Enterprise

ceSession = ceSessionMgr.Logon("Username", "Password", "ServerName", "secEnterprise")

'Create the infostore object

ceEnterpriseService = ceSession.GetService("", "InfoStore")

ceInfoStore = New InfoStore(ceEnterpriseService)

'check for reports on server

sQuery = "Select * From CI_INFOOBJECTS Where SI_PROGID = 'CrystalEnterprise.Report' AND SI_Name='" & ListBox1.SelectedItem.Text & "'" 'Lease_Portfolio_Activity'"

ceReportObjects = ceInfoStore.Query(sQuery)

 

'check for returned reports

If ceReportObjects.Count > 0 Then

ceReportObject = ceReportObjects.Item(1)

ceReport = CType(ceReportObject, Report)

ceEnterpriseService = ceSession.GetService("RASReportFactory")

Dim rrfObject As Object = ceEnterpriseService.Interface

Dim myReportAppFactory As ReportAppFactory = CType(rrfObject, ReportAppFactory)

Dim myReportClientDocument As ReportClientDocument = New ReportClientDocumentClass()

myReportClientDocument = myReportAppFactory.OpenDocument(ceReportObject.ID, 0)

CrystalReportViewer1.ReportSource = myReportClientDocument

CrystalReportViewer1.Visible = True

Else

'no objects returned by query

Response.Write("No report objects found by query <br>")

Response.Write("Please click <a href='Index.aspx'>here</a> to return to the logon page.<br>")

End If

ceSession.Dispose()

ceEnterpriseService = Nothing

ceInfoStore.Dispose()

ceReportObjects.Dispose()

ceReportObject.Dispose()

ceReport.Dispose()

ceParameterFields = Nothing

ceParameterField = Nothing

ceParameterDiscreteValue = Nothing

ceParameterRangeValue = Nothing

ceParameters.Dispose()

ceParameter.Dispose()

ceSessionMgr.Dispose()

End Sub

Any help would be highly apperciated.



Print Page | Close Window