使用数据表的Listview到Crystal Report [英] Listview to Crystal Report using datatable

查看:61
本文介绍了使用数据表的Listview到Crystal Report的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim ds As New Crystal_DS
        Dim DT_TAB As DataTable = ds.Tables.Add("Summary")
        If LV.Items.Count > 1 Then
            For i As Integer = 0 To LV.Items(0).SubItems.Count - 1
                Dim DCOL As New DataColumn(LV.Columns(i).Text)
                DT_TAB.Columns.Add(DCOL)
            Next
        End If
        For i As Integer = 0 To LV.Items.Count - 1
            Dim DROW As DataRow = DT_TAB.NewRow
            For j As Integer = 0 To LV.Items(i).SubItems.Count - 1
                DROW(LV.Columns(j).Text) = LV.Items(i).SubItems(j).Text
            Next
            DT_TAB.Rows.Add(DROW)
        Next
        DataGridView1.DataSource = ds.Tables("Summary")
        ''ds.Tables.Add(DT_TAB)
        ds.AcceptChanges()
        Dim objRpt As New TripSheet
        Dim strReportPath As String = Application.StartupPath & "\Cry_Chart\TripSheet.rpt"
        objRpt.Load(strReportPath)
        objRpt.SetDataSource(ds.Tables("Summary"))
        CrystalReportViewer1.ReportSource = objRpt
        ''CrystalReportViewer1.DataBind()



我在线上面用来查看水晶报告....但是在程序执行时没有任何显示......也没有错误....

我尝试从列表视图中读取数据并转换为数据表。最后在水晶报告中显示数据表...


I used above the lines for view the crystal report.... but nothing display while program execution time... and also no error....
I try to read the data from the listview and convert to data table. Finally display the datatable in the crystal report...

推荐答案

如果您的报告显示但没有数据,那么CR可能会希望您的数据已经存在。

您的.NET程序必须在运行读取数据集的报表之前将数据放入数据集。如何完成这取决于您如何设置数据集。

如果是表格,你可以打开表格。如果它基于查询,则必须运行查询。如果数据是通过代码生成的,那么您必须生成数据。

(例如,我有一个从Business Objects Enterprise XI进行用户审核的应用程序。它通过SDK从BO XI获取用户信息并将其保存到数据集中的表中。然后从我们的安全数据库读取用户信息并基于此更新表。然后打开审计报告。)



希望它有所帮助。
If your report is displaying but no data then there may be chances where CR wants your data to already be there .
Your .NET program has to put data into the dataset prior to running the report that reads the dataset. How this is done is dependent on how you''ve set up your dataset.
If it''s tables, you can just open the tables. If it''s based on a query, you have to run the query. If the data is generated through code, then you have to generate the data.
(For example, I have an app that does a user audit from Business Objects Enterprise XI. It gets the user information from BO XI through the SDK and saves it to a table in the dataset. It then reads user information from our security database and updates the table based on that. Then it opens up the audit report.)

Hope it helps.


这篇关于使用数据表的Listview到Crystal Report的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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