1

更新:我在这里问了一个更一般的问题: 我可以在 Crystal Reports 中进行两个级别的链接吗?

我在 VB.NET 和 Visual Studio 2005 中使用 Crystal Reports。

我有一个包含几个子报告的报告。我将 List(Of MainStuff) 设置为主报告的数据源。我将 List(Of SubreportStuff) 设置为子报表的数据源。每个 SubreportStuff 都有一个链接回特定 MainStuff 的键,因此报表将每个 MainStuff 项与其相关的 SubreportStuff 项分组。(或者,在数据库级别,SubreportStuff 项有一个外键,它是 MainStuff 中的主键。)

下面显示了对话框的加载函数,其中包含一个 CrystalReportsViewer。在 Crystal Reports 报表编辑器中(在 VS 2005 中),我将子报表链接设置为仅将相关项目拉入报表的该部分。

Imports System.Windows.Forms

    Public Class dlgMyReport
        Private rpt As New MyReport
        Public theMainList As New List(Of MainStuff)
        Dim theSubreportList As New List(Of SubreportStuff)

        Private Sub dlgMyReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            rpt.SetDataSource(theMainList)

            If theSubreportStuff.Count > 0 Then
                rpt.Subreports.Item("subReport").SetDataSource(theSubreportList)
            End If

            Me.StuffViewer.ReportSource = rpt
        End Sub

        ... ' other subs and functions

    End Class

这工作正常。

但是,现在,我需要做的本质上是相同的事情,但是根据子报表项中的键提取项。这意味着在子报表中有子报表。但是,我似乎无法做到这一点(当我尝试插入已经是子报表的内容时,插入子报表的选项显示为灰色)。

有没有办法可以做到这一点?(我可以以某种方式将子报表关系降低到另一个层次吗?)

一如既往的感谢!

4

1 回答 1

3

子报表中的子报表在 Crystal Reports 中是不可能的。

于 2010-01-30T04:51:59.703 回答