将两个数据表应用于Crystal数据源 [英] Applying two datatable to Crystal Datasource

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

问题描述

您好,

我想应用两个数据表单个报告数据源请帮我一个数据表禁令图像和另一个数据表包含来自数据库的数据

rpt.SetDataSource(dt1)

rpt.SetDataSource(dt)





使用vb.net和crstal报告





谢谢

Hello,
I want to apply two datatable single report datasource please help me one datatable contrain Image and another datatable contain data from database
rpt.SetDataSource(dt1)
rpt.SetDataSource(dt)


using vb.net and crstal report


Thank You

推荐答案

传递 DataSet 而不是 DataTable s

Pass DataSet instead of DataTables
DataSet ds = new DataSet();
ds.Tables.Add(dt1);
ds.Tables.Add(dt);
rpt.SetDataSource(ds);



并确保表格相同(报告表和数据表名称)。使用 TableName属性 [ ^ ]您可以更改名称。

FYI

来自C#Crystal Reports多个表格 [ ^ ]

在ASP.NET中创建包含多个表的Crystal报表 [ ^ ]


And make sure the tables are same(both report tables & DataTable names). Using TableName Property[^] you could change the name.
FYI
C# Crystal Reports from multiple tables[^]
Creating Crystal Report with Multiple Tables in ASP.NET[^]


制作视图或自定义函数或存储过程在这两个数据库中的一个。我更喜欢在Master Database中创建它。假设您在(dt1)中创建了一个存储过程,然后生成一个临时表并使用两个数据库数据加载它。从你的水晶报告中调用该存储过程仅使用

Make a view or in custom function or stored procedure in one of those two database. I prefer to make it in Master Database. Let say you make a stored procedure in (dt1) then generate a temporary table and load it with both database data. call that stored procedure from your crystal report only use
rpt.SetDataSource(dt1)



它会更快性能。


it will be faster in performance.




您可以选择两个选项。一个使用键入的数据集,第二个是子报告



类型化数据集将采用多个数据表,并定义关系,并根据报告生成的数据。



在ASP.Net中使用Crystal Reports使用强类型数据集 [ ^ ]



子报告是另一个与主报告相关的报告。您可以在单个主报告中包含任意数量的子报告。

创建Crystal Reports中的子报表 [ ^ ]

添加子报告原始报告 [ ^ ]

使用其功能组,图形,交叉表和子报告逐步创建Crystal报告 [ ^ ]

Crystal Reports和子报告 [ ^ ]



我建议使用子报告。



希望它有所帮助。
Hi,
You can go with two options. One by using "Typed DataSets" and Second is "Sub Report".

Typed datasets will take multiple datatables with relationship defined and based on which the report would get generated.

Using Crystal Reports in ASP.Net Making use of strongly typed datasets[^]

Sub report is another report by itself linked to the main report. you can have any number of sub report in single main report.
Create a Subreport in Crystal Reports [^]
Adding a Subreport to the Original Report[^]
Step by Step Creation of Crystal Report using its Features Group, Graph, Cross-Tab and Sub Report[^]
Crystal Reports and Subreports[^]

I recommend to go with subreports.

hope it helps.


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

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