locked
Crystal Reports Unknown Query Engine Error

    Question

  • I am in the process of migrating an application that was originally developed with VS2003 and VB.Net to VS2008 and C#.  It is a Visio Add-in that also uses VSTO.  The application uses Crystal Reports to report on data stored in a disconnected dataset (no database connection at all at this time).

    I have a number of reports that all worked fine in the original version of the application that all fail with the "Unknown Query Engine" error - unfortunately, this error message isn't very descriptive and doesn't give you a clue of what the real issue is.   A few additional notes:

    - I am attempting to run the reports on the development system in debug mode so it isn't a deployment issue
    - I have installed Crystal Reports SP1 for Visual Studio 2008
    - I have registered the version of Crystal Reports on my development system
    - I have gone through all the reports and verified the database connection for each
    - I have also run the custom tool on each report to regenerate the code-behind file
    - I have been through the Crystal Reports support site and it suggested that Crystal Reports SP1 might resolve this problem, but it didn't

    Does anyone have any additional ideas or suggestions on how to resolve this problem?

    Thanks,

    Chuck

    Here's the complete text of the error message from Crystal Reports:

    CrystalDecisions.CrystalReports.Engine.DataSourceException: Unknown Query Engine Error

    Error in File C:\Users\Chuck\AppData\Local\Temp\temp_61bb6760-ed7d-4388-ac40-4467ead5ea5a {6605FB54-FBF8-44A8-A663-3FE812F04FF4}.rpt:

    Unknown Query Engine Error ---> System.Runtime.InteropServices.COMException (0x800002C2): Unknown Query Engine Error

    Error in File C:\Users\Chuck\AppData\Local\Temp\temp_61bb6760-ed7d-4388-ac40-4467ead5ea5a {6605FB54-FBF8-44A8-A663-3FE812F04FF4}.rpt:

    Unknown Query Engine Error

       at CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.ReplaceConnection(Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault)

       at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)

       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)

       --- End of inner exception stack trace ---




    Chuck
    Saturday, October 24, 2009 3:28 PM

All replies

  • Hi,

    Migration to Crystal Reports for Visual Studio 2008 is automatic. Have you tried create a new report and show it with vs 2008? Does it work well?

    Harry

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, October 26, 2009 7:36 AM
  • I created a new report and got the same problem.  I think the problem may be a code access security problem caused by user access control.  I'm now using a Vista system to do development and testing because I want to be able to support the software on Vista and Windows 7.  The following post indicates that file access security may be the problem:

    http://social.msdn.microsoft.com/Forums/en-US/vscrystalreports/thread/066467af-a88f-4643-8b37-c749f1abdcba

    The above post is probably accurate but doesn't really provide a clear explanation of how to implement the solution and also doesn't provide guidance on how to deploy it to another target machine (I presume that if this is the solution, you would have to design some kind of installer to implement it on a target machine).

    Can someone please clarify how to implement and deploy the above solution?

    Thanks,

    Chuck


    Chuck
    Tuesday, October 27, 2009 12:17 PM
  • I have done some more research into this problem and I'm convinced that the problem is related to giving full trust to the Crystal Reports application.  I've read a lot of information that the Crystal Reports engine needs full trust to run and I've seen other posts that saw this error where the problem was full trust.

    I'm unsure of how to assign full trust to Crystal Reports.  I've seen one post on that:

    http://social.msdn.microsoft.com/forums/en-US/vscrystalreports/thread/066467af-a88f-4643-8b37-c749f1abdcba

    However, the above must be for a different version of Crystal Reports because I don't see the directory they reference on my system at all:

    C:\Program Files\Common Files\Business Objects\2.7\bin

    I'm using the standard version of Crystal Reports that comes with VS2008 - can any one tell me what I need to do to grant full trust to it when I deploy my application to a target system?  (I know how to assign full trust to an application programmatically, I just don't know exactly which Crystal Reports assemblies I need to assign full trust to and where they are located.

    Thanks,

    Chuck
    Wednesday, November 18, 2009 3:44 PM
  • I've been working with Crystal Reports support on this and I have made some progress in narrowing down the problem.  I had to re-architect my application so that the reports and the dataset were in a separate Data Access Layer that could be called either from within the Visio Add-in or from an external Windows forms application that is a separate, standalone EXE. I've also persisted the data to a SQL Server CE database that is common to the two configurations.

    When I call the Crystal Reports from my standalone EXE, it works fine...when I call the same report with the same data (and the same code to generate the report) from within the Visio Add-in, I get the unexpected query engine error. The code in both configurations that is associated with producing the reports is 98% the same...the primary difference is that the code is running inside of two different environments:

    - In one case, it's running inside a standard WinForms EXE application (that works fine), and
    - In the other case, it's part of a DLL that is running under the control of the Visio process as a Visio Add-in (When an application runs as a Visio Add-in, it runs in the same process space as VISIO.EXE)

    I hate to give up the capability to run these reports in the Visio environment from inside the Add-in. It appears that Visio is somehow interfering with Crystal Reports' ability to produce the reports. The most likely cause to me still seems to be a code access security problem. (i.e. the Crystal Reports engine has not been granted full trust)

    The reason I suspect this is that I have had a lot of other code access security problems..the VSTO loader would not load my Add-in at all until I created a security policy on the target machine that granted full trust to my Add-in assembly. I could do a similar thing for Crystal Reports, but I have no idea what assemblies I need to grant full trust to.

    Any additional ideas on how to solve this problem?

    Thanks,

    Chuck
    Chuck
    Wednesday, December 09, 2009 3:31 PM
  • Mybe the value of Record Selection that you set is wrong.

    Remove the value and test again!

    Sunday, April 18, 2010 5:51 AM