Answered by:
Framework 4.0 & Crystal Reports: problem with SetDataSource method

Question
-
I have a dll build with target framework 3.5 that manage reports; this dll use the version 10.5.3700.0 of CrystalDecisions.CrystalReports.Engine
Now, I have created a new wpf application based on .NET framework 4.0 and I added the report dll reference to project.
I had to install the Crystal Reports for Visual Studio 2010 library (http://www.businessobjects.com/jump/xi/crvs2010/default.asp ) to build the application without errors...now it builds success, but the report print don't work.
It's generate an error when set datasource...the message is:
Unknown Query Engine Error Error in File C:\DOCUME~1\oli15\IMPOST~1\Temp\MyReport {4E514D0E-FC2C-4440-9B3C-11D2CA74895A}.rpt: ... Source=Analysis Server ErrorCode=-2147482942 StackTrace: 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)
The problem is method ReportDocument.SetDataSource; if I switch my application to framework 3.5 it work, if I use framework 4.0 it generate a report exception. Why?!?!?Wednesday, June 16, 2010 1:41 PM
Answers
-
Finally!
After 15 hours of debugging tracing i finally figured it out. After digging around in WinDbg i found out that the problem has it root in FW 4.0 Assembly bindning behavor. So to be able to load V1.1 compiled assemblies i needed to add the attribute bolted below to my *.config file.
<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
God luck!
Johan- Marked as answer by Harry Zhu Wednesday, July 7, 2010 8:45 AM
Thursday, June 24, 2010 9:10 PM
All replies
-
Anyone?Thursday, June 17, 2010 7:04 AM
-
Same problem no sultion
JohanThursday, June 24, 2010 5:12 PM -
Finally!
After 15 hours of debugging tracing i finally figured it out. After digging around in WinDbg i found out that the problem has it root in FW 4.0 Assembly bindning behavor. So to be able to load V1.1 compiled assemblies i needed to add the attribute bolted below to my *.config file.
<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
God luck!
Johan- Marked as answer by Harry Zhu Wednesday, July 7, 2010 8:45 AM
Thursday, June 24, 2010 9:10 PM -
exactly! I tried the same thing in these days and seems it works!
Thursday, June 24, 2010 9:22 PM -
Works fine! Ty much man!
Monday, August 30, 2010 10:43 AM -
Thanks for the post. It definately saves me couple of hours. We moved from VS 2008 to VS 2010 and Crystal Report Document.
SetDataSource() started throwing this error. After I update the app.config file to include your setting, it work like a charm.
Thanks for very useful post.
HD
Monday, February 14, 2011 11:07 PM -
Thank you, Johan! That resolved similar problem that I was getting.
Tuesday, March 1, 2011 6:37 PM -
Hi Guys,
There are few other known issues also. Go to SAP's CR .NET SDK forum for more info and updates: http://forums.sdn.sap.com/forumfilter.jspa?forumID=313
When compiling your software use only x86 or x64, do not use AnyCPU and any platform. Issues with distribution packages and bootstrapping
You can not use c:\temp as your default temp folder, name it to anything else like c:\MYtemp. Causes the Database Expert Wizard and set location to crash VS 2010.
And more as we work through the kinks. Most of the issues have now been identified and should be resolved in Service Pack 1 or 2.
Thank you for your support of both VS and CR for .NET 2010.
Don
Don WilliamsWednesday, March 2, 2011 4:29 PM -
I'm kissing your legs :-) Thank you very much.Tuesday, May 3, 2011 5:46 PM
-
I have a problem when I refresh my Crystal Report in my Crystal Report Viewer I was invited to enter the parameter to my Crystal Report how could I send the parameters from the Crystal Report Viewer to my Crystal Report without having this interface of parameters !!!
Everything is possible, nothing is impossible. Just try and you will find that.- Proposed as answer by Saâd HAFFAR Tuesday, May 3, 2011 9:07 PM
Tuesday, May 3, 2011 9:05 PM -
This post is marked as answered, search first, you'll find sample links to set parameter values in code so it's not prompting you.
Don
Don WilliamsTuesday, May 3, 2011 10:17 PM -
What's the problem !! I have marked this question as an answer to have so interest !!
Everything is possible, nothing is impossible. Just try and you will find that.- Proposed as answer by Momox123 Monday, July 4, 2011 11:13 PM
Thursday, May 5, 2011 12:30 PM -
Hi,
I am also having the same problem. Above solution solved my problem.
Thanks allot!!
Cnu...
Thursday, June 16, 2011 8:48 PM