Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: .Net 2005 and Crystal Enterprise 10 Post Reply Post New Topic
Author Message
dalden
Newbie
Newbie


Joined: 20 Sep 2007
Location: United States
Online Status: Offline
Posts: 3
Quote dalden Replybullet Topic: .Net 2005 and Crystal Enterprise 10
    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.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.