需要帮助打开基于数据集中的2个表的水晶报告 [英] Need help opening crystal report based off 2 tables in dataset

查看:62
本文介绍了需要帮助打开基于数据集中的2个表的水晶报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单,其中包含一个表中包含帐户记录的数据集,另一个表包含另一个表中帐户的事务。我正在尝试使用内部联接基于这两个表创建报表。我使用报告向导来创建我的报告,当我打开它时,它只是坐在那里而不是像它挂起的那样填充。数据集在一个表中可能有大约4500条记录,而事务文件有35K条记录。这是我用来打开报表查看器并加载报表的代码。任何帮助都会很棒!

I have a form with a dataset that contains account records in one table and another table that contains transactions for accounts that are in the other table.  I'm trying to create a report based on the two tables using an inner join.  I used the report wizard to create my report and when I open it it just sits there not populating like it is hanging.  The dataset maybe has about 4500 records in one table and the transaction file has 35K records.  here is the code I'm using to open the report viewer and load the report.  Any help would be great!

私人 Sub Form3_Load( ByVal sender As System.Object, ByVal < font size = 2> e As System.EventArgs) 句柄 MyBase .Load

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

reportDocument1.Load(Application.StartupPath& " \CrystalReport2.rpt"

reportDocument1.Load(Application.StartupPath & "\CrystalReport2.rpt")


reportDocument1.SetDataSource(Form1.SQLDataSet)

reportDocument1.SetDataSource(Form1.SQLDataSet)

reportDocument1.Refresh()

reportDocument1.Refresh()

使用 CrystalReportViewer1 'ReportViewer1

With CrystalReportViewer1 'ReportViewer1

.DisplayGroupTree = True

.DisplayGroupTree = True

.DisplayToolbar = True

.DisplayToolbar = True

.ReportSource = reportDocument1

.ReportSource = reportDocument1

.Refresh()

.Refresh()

结束 使用

End With

结束 Sub

End Sub

推荐答案

首先,你不需要调用刷新方法。

first thing, you do not need to call the refresh methods.

其次,在创建数据集时,使用连接表的sql查询,这样你在数据集中只有1个表(多个表使得对于一个丑陋的混乱,既缓慢又大量的内存使用。我看到报告需要一个小时来生成,因为有两个表格。写出该数据集的模式(xsd),并将报告基于该数据集。除此之外,它应该工作。

secondly, when creating the dataset, use a sql query that joins the tables so that you only have 1 table in the dataset (multiple tables makes for an ugly mess, both with slowness and lots of memory usage.  I have seen reports take an hour to generate because of two tables).  Write out the schema (xsd) for that dataset and base your report off of that.  other than that it should work.


这篇关于需要帮助打开基于数据集中的2个表的水晶报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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