Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 4th, 2007, 12:41 PM
Authorized User
Join Date: Feb 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help ASP with CE10


I am with a problem when executing a report in the ASP, does not appear value in this report.
Somebody knows to say what this happening.

It follows the code:

Página que chama o relatório.

dim tPrograma
Dim cd_programa

cd_programa = Split(Request.item("cd_programa"), "|", 2, 1)
tPrograma = cd_programa(0)
reportname = "relatorio"
'####################### Crystal Enterprise 10 ##################
Dim objCE
Set objCE = New clsCE2
With objCE
If .LogonCrystal() = True Then
     If .getreport("pasta", reportname) = True Then
                Call .ConfigurarBD()
                Call .PassarParametros("P_TPROGRAMA", tPrograma)
                Call .PassarParametrosSub("Atividades", "P_TPROGRAMA", tPrograma)
                Call .PassarParametrosSub("Orcamentos", "P_TPROGRAMA", tPrograma)
                Call .callsReport()
      End If
End If
End With
Set objCE = Nothing

Stretches of Classe clsCE.asp

Class clsCE2
    Private objSessionMgr
    Private objSessionCE
    Private objInfoStore

    Private objInfoObject
    Private objReportAppFactory
    Private objReportDocument

    Private m_IdRelatorio

    Public g_ServerBD
    public g_Banco
    Public g_UserBD
    Public g_PwdBD

    Public g_DataSource

    Public gstrParametros

    Public gParamsSub
    Private gCntParam

    private gstrFormula

Sub callsReport()

        'Declara ReportAppFactory e ReportDocument
        Dim rptFactory
        Dim rptDoc

        Set rptFactory = objSessionCE.Service("", "RASReportFactory")
        Set rptDoc = rptFactory.OpenDocument(CLng(m_IdRelatorio))

        On Error Resume Next

        Dim oDBInfo
        Dim pbLevel1
        Dim pbLevel2

        Set oDBInfo = rptDoc.DatabaseController.GetConnectionInfos().Ite m(0)

        Set pbLevel1 = oDBInfo.Attributes

        pbLevel1.Item("QE_ServerDescription") = g_ServerBD

        Set pbLevel2 = pbLevel1.item("QE_LogonProperties")
        With pbLevel2
          .Item("Data Source") = g_ServerBD
          .Item("Initial Catalog") = g_Banco
        End With
        Response.Write g_ServerBD & "<br>"
        Response.Write g_Banco & "<br>"

        pbLevel1.Item("QE_LogonProperties") = pbLevel2

        oDBInfo.Attributes = pbLevel1
        oDBInfo.UserName = g_UserBD
        oDBInfo.Password = g_PwdBD

        Response.Write g_UserBD & "<br>"
        Response.Write g_PwdBD & "<br>"
        Dim Tables
        Dim newTable

        Set Tables = rptDoc.DataDefController.Database.Tables
        For Each table in Tables
          Set newTable = Table.Clone
          newTable.ConnectionInfo = oDBInfo
          newTable.QualifiedName = Table.Name
          rptDoc.DatabaseController.SetTableLocation table, newTable


        Set subReportNames = rptDoc.SubReportController.QuerySubreportNames
        For each subName in subReportnames

          Set subTables = rptDoc.SubReportController.GetSubreportDatabase(su bName).Tables

          For each subTable in subTables
            Set newSubTable = subTable.Clone
            newSubTable.ConnectionInfo = oDBInfo
            newSubTable.QualifiedName = subTable.Name
            rptDoc.SubReportController.SetTableLocation subName, subTable, newSubTable


        If Trim(gstrParametros) <> "" Then

            strValor = Mid(gstrParametros,1, Len(gstrParametros) - 1)
            arr_Parametros = Split(strValor, "|")

            gstrParametros = Mid(gstrParametros,1, Len(gstrParametros) - 1)

            Dim strNome
            Dim i, j
            For i = 0 to UBound(arr_Parametros)
                strNome = arr_Parametros(i)
                j = i + 1
                strValor = arr_Parametros(j)
                i = j

                rptDoc.DataDefController.ParameterFieldController. SetCurrentValue "", strNome, strValor
        End If
        If gParamsSub.Count > 0 Then
            Dim vItem
            Dim ind
            Dim vNomeSub
            Dim vNomeParam
            Dim vValorParam
            Dim bSetar
            Dim arr_ParametrosSub

            For Each vItem in gParamsSub
                arr_ParametrosSub = Split(gParamsSub.Item(vItem), "|")
                vNomeSub = arr_ParametrosSub(0)
                For ind = 1 to Ubound(arr_ParametrosSub)
                    If ind mod 2 = 1 Then
                        vNomeParam = arr_ParametrosSub(ind)
                    End If
                    If ind mod 2 = 0 Then
                        vValorParam = arr_ParametrosSub(ind)
                    End If
                rptDoc.DataDefController.ParameterFieldController. SetCurrentValue vNomeSub, vNomeParam, vValorParam
        End If

        If gstrFormula <> "" Then
            rptDoc.DataDefinition.RecordFilter = gstrFormula
        End If
        Response.ExpiresAbsolute = Now() - 1

        Response.ContentType = "text/html"
        Response.CharSet = "UTF-8"
        Session.CodePage = 65001

        Dim CrViewer1
        Set CrViewer1 = CreateObject("CrystalReports.CrystalReportInteract iveViewer")

        Dim BooleanSearchControl
        Set BooleanSearchControl = CreateObject("CrystalReports.BooleanSearchControl" )
        BooleanSearchControl.ReportDocument = rptDoc

        With CrViewer1
            .Name = "Crystal Reports Interactive Viewer"
            .IsOwnForm = True
            .IsOwnPage = True
            .IsDisplayGroupTree = False
            .HasToggleGroupTreeButton = True
            .BooleanSearchControl = BooleanSearchControl

            .ReportSource = rptDoc.ReportSource

            .EnterpriseLogon = Session("es")

            .ProcessHttpRequest Request, Response, null
        End With

    End Sub

Similar Threads
Thread Thread Starter Forum Replies Last Post
send parameters from asp page to an asp.net form hastikeyvan ASP.NET 1.0 and 1.1 Basics 2 March 29th, 2008 01:32 AM
using asp.net web user control in asp 3.0 App i_shahid Classic ASP Professional 0 January 8th, 2008 07:32 AM
Upgrading ASP w/ SQLserver 2000 to ASP.NET w/2005 cJeffreywang ASP.NET 2.0 Basics 1 April 5th, 2007 11:30 PM
CE10 Report Viewer err cmbaxter Crystal Reports 2 October 7th, 2004 04:48 AM
Porting a sa,ple ASP CR viewer app to ASP.NET jhansen42 Crystal Reports 0 August 29th, 2003 10:26 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.