Results 1 to 2 of 2

Thread: Crystal Reports XI fails with "Query Engine Error" when changing parameter values

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    4

    Unhappy Crystal Reports XI fails with "Query Engine Error" when changing parameter values

    I'm using Crystal Reports XI, VB.Net 2003, and Oracle 9i. If I change the parameter values to a stored procedure or use the report's "Refresh" method, I get at "Query Engine Error" and the complete path to the report.

    I used the code from
    http://technicalsupport.businessobje...search.do?cmd=
    displayKC&docType=kc&externalId=c2011787&sliceId=&dialogID=360384&stateId=1%
    200%20356275
    as a guide line

    The report works corectly in Crystal Reports, but does not allow the
    parameters to be changed when called from VB.Net. I Get the same error
    message "Query Engine Exception" followed by the name of the report.

    This is the code I'm using. Do you see any problems with it?

    THANKS!
    Rita

    Me.CrystalReportViewer1.Visible = True

    Dim oRpt As New StoredProcedure_ODBC

    Dim crTables As Tables
    Dim crTable As Table
    Dim crTableLogOnInfo As TableLogOnInfo
    Dim crConnectionInfo As New ConnectionInfo
    Dim crParameterValues As ParameterValues
    Dim crParameterDiscreteValue As ParameterDiscreteValue
    Dim crParameterFieldDefinitions As ParameterFieldDefinitions
    Dim crParameterFieldDefinition As ParameterFieldDefinition

    'Set the Connection parameters
    With crConnectionInfo

    'http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do;jse
    ssionid=3667C5A3D60BAA3FCBBD98F64B793994?cmd=displayKC&docType=kc&externalId
    =c2010371&sliceId=&dialogID=360384&stateId=1%200%20356275
    'Says that when connecting to Oracle there is NO
    DATABASE NAME
    .DatabaseName = ""
    .ServerName = "ServerName"
    .UserID = "DBId"
    .Password = "DBPassword"
    End With

    crTables = oRpt.Database.Tables

    'Set the logon information for each table.
    For Each crTable In crTables
    crTableLogOnInfo = crTable.LogOnInfo
    crTableLogOnInfo.ConnectionInfo = crConnectionInfo
    crTable.ApplyLogOnInfo(crTableLogOnInfo)
    Next

    '*****************************
    ' Pass the Stored Procedure parameter to the report
    '*****************************

    'Get the collection of parameters from the report
    crParameterFieldDefinitions =
    oRpt.DataDefinition.ParameterFields

    'Access the specified parameter from the collection
    crParameterFieldDefinition =
    crParameterFieldDefinitions.Item("PRODUCT_ID")

    'Get the current values from the parameter field. At this
    point
    'there are zero values set.
    crParameterValues = crParameterFieldDefinition.CurrentValues

    'Clear existing parameter values
    crParameterValues.Clear()

    'Set the current values for the account handle parameter
    field
    crParameterDiscreteValue = New ParameterDiscreteValue
    crParameterDiscreteValue.Value = "TINKERTOYS"

    'Add the current value for the parameter field
    crParameterValues.Add(crParameterDiscreteValue)

    'The current parameter values must be applied for the
    parameter field.

    crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

    CrystalReportViewer1.ReportSource = oRpt

  2. #2

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    4

    Re: Crystal Reports XI fails with "Query Engine Error" when changing parameter values

    I've come up with a "semi-solution". The report works just fine in VB 6.0. If I use the VB 6.0 viewer and object model, the report works correctly in my VB.Net application.

    HOWEVER, I really hate this "fix". I end up having two viewers in my program. A VB.Net viewer to handle the reports that do NOT access a stored procedure and a VB 6.0 viewer to handle the one report that has a stored procedure.

    Any ideas will be DEEPLY appreciated.

    THANKS!
    Rita

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width