子报告在水晶报告中没有任何价值

时间:2013-11-05 11:11:05

标签: vb.net crystal-reports

我在水晶报告中有一个子报告..我正在使用vb.net enter image description here

  

delParkingtype.rpt

我创建了子报告。然后我将此报告称为我的水晶报告查看器:

        Dim rpt As New DelivaryPerformance
        Dim rpt1 As New DelParkingtype
        Dim locid As Integer = RecordID("Locid", "Location_tbl", "LocName", CmbLocations.Text)
        Dim cmdstatus As New SqlCommand("IBS_DelivaryStaus", con.connect)
        cmdstatus.CommandType = CommandType.StoredProcedure
        cmdstatus.Parameters.Add("@locid", SqlDbType.Int).Value = locid
        da.SelectCommand = cmdstatus
        da.Fill(ds)
        If (ds.Tables(0).Rows.Count > 0) Then

            rpt.SetDataSource(ds.Tables(0))
            ' CrystalReportViewer1.ReportSource = rpt
        End If
        Dim cmdparkingtype As New SqlCommand("IBS_Delivaryparkingtype", con.connect)
        cmdparkingtype.CommandType = CommandType.StoredProcedure
        cmdparkingtype.Parameters.Add("@locid", SqlDbType.Int).Value = locid
        da1.SelectCommand = cmdparkingtype
        da1.Fill(ds1)
        If (ds1.Tables(0).Rows.Count > 0) Then

            rpt1.SetDataSource(ds1.Tables(0))
            CrystalReportViewer1.ReportSource = rpt1
            CrystalReportViewer1.ReportSource = rpt
        End If

但是

  

DelParkingtype没有填写任何数据......我的代码有什么问题

1 个答案:

答案 0 :(得分:0)

您应该执行以下操作,您必须将数据源添加到主报表的子报表中。之后,您只需将主报告添加到reportSource。

rpt.Subreports(0).SetDataSource(ds1.Tables(0))
CrystalReportViewer1.ReportSource = rpt;

你不需要这个

Dim rpt1 As New DelParkingtype

希望这有助于你

相关问题