Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crystal Report weird error (Unknown Query Engine Error)

I have a Windows application that uses Crystal Reports 2008 as a reporting tool. It was working fine for a very long period, but yesterday, when I tried to load any report, I got this error:

CrystalDecisions.CrystalReports.Engine.DataSourceException: Unknown Query Engine Error
Error in File C:\Users\Magdy\AppData\Local\Temp\rpt_Stock_Cost {DC276D4F-79F4-43B9-8168-24E6B7BF490A}.rpt:
Unknown Query Engine Error ---> System.Runtime.InteropServices.COMException: Unknown Query Engine Error
Error in File C:\Users\Magdy\AppData\Local\Temp\rpt_Stock_Cost {DC276D4F-79F4-43B9-8168-24E6B7BF490A}.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 ---
   at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet)
   at Diamonds.UIL.Forms.frm_ReportViewer.Load_Report(String File_FullPath, DataSet DS) in E:\Development\Bitco\Diamond\Project\Diamond 2.0.1\Diamonds\UIL\Reports\Forms\Viewer\frm_ReportViewer.cs:line 256

Here's the code I used to load and assign data source for the report:

DataSet ds = new DataSet();
reportDocument_.Load(File_FullPath);
reportDocument_.SetDataSource(ds);

Where ds could be a typed dataset.

After some googling, I found some results that say I should have Network Services, user to temp folder in windows. Although I think this is for web applications, not for windows. I tried it for both temp folder, and the above folder in the exception, but neither helped.

I'm using Visual Studio 2010, C# 4.0, Windows Application

Any ideas what could be wrong?

like image 245
Mustafa Magdy Avatar asked Jul 07 '11 12:07

Mustafa Magdy


1 Answers

If you compile in VS2010 (or VS2012) on a Win7 machine, try adding the following to the app.config:

<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>

If that doesn't work (like on my machine), try compiling in VS2010 on WinXP machine.

like image 84
Tono Avatar answered Sep 28 '22 09:09

Tono