VS 2012/2013的Crystal报表崩溃了应用程序 [英] Crystal reports for VS 2012/2013 crashes application

查看:157
本文介绍了VS 2012/2013的Crystal报表崩溃了应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这实际上是两个问题。



我有一个运行完美的应用程序,直到我设置一个水晶报表。

基本上我用我正在寻找的数据填充数据集,使用LINQ查询,代码如下:



  Dim  ds  As   TalkScheduleDataSet 
Dim dt As DataTable = ds.TalkSchedule

Dim sched = from s In db.TalkSchedules where s。 Date > = CDate (startDate) _
s。日期< = CDate (endDate)_
选择 s

' 填充数据集
Dim rpt As ReportDocument
每个 sch Sched
dt.Rows.Add(sch)' 缩写。
下一步

< span class =code-comment>' 该报告取自Crystal Reports,rptTalksSchedule.rpt文件
Dim rpt 作为 ReportDocument
rpt = rptTalksSchedule

' 此处崩溃。
rpt.SetDataSource(ds)

' 永远不要走这么远。
CrystalReportViewer1.ReportSource = rpt



错误是:

VS 2012

无可用来源

调用堆栈只包含外部代码

混合模式程序集是针对版本v2.0.50727构建的,并且无法在没有其他配置的情况下在4.0运行时加载


类型'System.IO.FileLoadException'的未处理异常发生在

mscorlib.dll



VS 2013年错误大致相同,格式不同



两者都与CrystalDecisions.ReportAppServer.DataSetConversion.dll有关



我有另一个应用程序,我已经从VS2008升级到2013年,它也是如此,它运行完美,使用相同的预填充DataSet用于几种不同的CrystalReport表单。每个表单都按照预期的方式显示数据。



无法理解发生了什么。两个应用程序使用相同的CrystalReports版本(13.0.2000.0)



CrystalDecisions.CrystalReports.Engine

CrystalDecisions.ReportSource

CrystalDecisions.Shared

CrystalDecisions.Windows.Forms



过去我在了解怪癖方面遇到了很多问题Crystal Reports和我实际上更喜欢使用VS内置的reportviewer,但我无法使用它来处理数据集。填充数据集后,它不会随数据更新。



ReportViewer是否有一个很好的演练。不是仅使用向导的基本功能。我需要格式化报告并获取特定数据,如上面的子例程所示。我构建了报告,将其添加到表单上的ReportViewer并添加了



 ReportViewer1.Refresh 
- 或/和 -
ReportViewer1.Update





两者都不行,虽然我知道数据集中有数据。



希望我已经足够清楚。

感谢您的帮助。

解决方案

将此添加到app.config



< startup useLegacyV2RuntimeActivationPolicy =true>

< supportedRuntime version =v4.0sku =。NETFramework,Version = v4.5/>

This is actually two questions.

I have an application that runs "perfect" until I set up a crystal report form.
Basically I fill a dataset with the data I'm looking for using a LINQ query with the following code:

Dim ds As New TalkScheduleDataSet
Dim dt As DataTable = ds.TalkSchedule

Dim sched = From s In db.TalkSchedules Where s.Date >= CDate(startDate) And _
            s.Date <= CDate(endDate) _
            Select s

'Fill the dataset
Dim rpt As New ReportDocument
    for each sch In Sched
    dt.Rows.Add(sch)   'Abbreviated.
Next

'The report is taken from Crystal Reports, rptTalksSchedule.rpt file
Dim rpt As New ReportDocument
rpt = New rptTalksSchedule

'Crashes right here.
rpt.SetDataSource(ds)

'Never get this far.
CrystalReportViewer1.ReportSource = rpt


Error is:
VS 2012
No source available
The call stack contains only external code
Mixed mode assembly is built against version 'v2.0.50727' and cannot be
loaded in the 4.0 runtime without additional configuration.
An unhandled exception of type 'System.IO.FileLoadException' occurred in
mscorlib.dll

VS 2013 error is about the same with different formatting

Both have to do with CrystalDecisions.ReportAppServer.DataSetConversion.dll

I have another application I have upgraded from VS2008 to 2013, which does the same, and it works perfectly, using the same pre-filled DataSet for several different CrystalReport forms. Each form displays the data the way it is supposed to.

Can't understand what's going on. Both applications use the same CrystalReports versions (13.0.2000.0)

CrystalDecisions.CrystalReports.Engine
CrystalDecisions.ReportSource
CrystalDecisions.Shared
CrystalDecisions.Windows.Forms

In the past I've had a lot of problems getting to know the eccentricities of Crystal Reports and I actually would prefer to use the VS built in reportviewer, but I can't get it to work with the dataset. It won't update with the data after I fill the dataset.

Is there a good walkthrough for the ReportViewer. Not the basic ones that only use the Wizard. I need to format the report and get specific data, as shown in the subroutine above. I built the report, added it to a ReportViewer on the form and added

ReportViewer1.Refresh
     '-or/and-
ReportViewer1.Update



Neither works, although I know the Dataset has data in it.

Hope I've been clear enough.
Thanks for all your help.

解决方案

Add this to app.config

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


这篇关于VS 2012/2013的Crystal报表崩溃了应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆