如何将两个或多个数据表组合到Crystal Report中的单个数据表中 [英] how to combine two or more data table into single data table in Crystal Report

查看:64
本文介绍了如何将两个或多个数据表组合到Crystal Report中的单个数据表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我有两个数据表必须将两个数据表合并为一个数据表,并需要将组合数据表用于水晶报告的报告源。



i合并了两个数据表,但在水晶报表中显示更多没有页面没有显示组合数据表值到单页。

Hi i have two data tables have to combine two data table into one data table and need to use the combined data table into report source for crystal report.

i merged two data table but in the crystal report it displaying more no pages not showing combined data table values into single page.

推荐答案

然后需要查看你的代码。您是否使用 datatable.merge 组合到2个数据表?基本上它需要:

Then need to see your code. Do you use datatable.merge to combine to 2 datatables? Basically it would like:
DataTable dt1 = new DataTable();
DataTable dt2 = new DataTable();
DataTable dt3 = dt1.Copy();
dt3.Merge(dt2);



一些不错的选择可能是:

DataTable.LoadDataRow方法 [ ^ ]

DataTable.ImportRow Method [ ^ ]


您可以使用DataTable.Merge方法组合两个数据表值。看看链接



http://msdn.microsoft.com/en-us/library/fk68ew7b%28v=vs.110%29.aspx [ ^ ]



http://forums.asp.net/t/1416974.aspx [ ^ ]









你可以去sql查看。只需创建sql视图,然后使用该视图填充报表上的数据。这样可以提高性能,并且您可以在单个数据表中获取记录。
Hi you can use DataTable.Merge Method to combine the two data table values. have look of the link

http://msdn.microsoft.com/en-us/library/fk68ew7b%28v=vs.110%29.aspx[^]

http://forums.asp.net/t/1416974.aspx[^]

OR


you may go for sql view. just make sql view and then use that view to populate the data on report. This improve performance and you will be able to get the record in a single datatable.


您可以通过在数据库中创建视图来简单地添加两个表。然后,水晶报告将是更容易。



例如:



表1:学生(sid,sname,scid)

表2:课程(cid,cname)



学生scid从课程cid引用。你可以创建视图,



创建视图学生课程

作为选择s.sid,s.sname,s.scid,c.cname

来自学生,当然c



现在您可以将视图作为单个数据集访问,但是您需要所有列。

这是非常简单的way.i一直这样做。
Rather than adding two tables you can simply do it by creating a view in database.then crystal report will be much more easier.

example:

table 1:student(sid,sname,scid)
table 2:course(cid,cname)

student scid is referenced from course cid.you can create view,

create view studentcourse
as select s.sid,s.sname,s.scid,c.cname
from student s,course c

now you can access view as a single data set but there are all the columns you need.
this is really easiest way.i do it all time.


这篇关于如何将两个或多个数据表组合到Crystal Report中的单个数据表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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