Crystal Report使用ADO.NET Dataset [英] Crystal Report using ADO.NET Dataset

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

问题描述

我有下面给出的表

客户:custId,custName

订单:ordID,ordName,amount,custID

我想使用这两个表生成一个报告,它应该看起来像

custID - xxxx custName - xxxx

< h6> OrderID OrderName
1 aaa

2 bbb

3 ccc

任何人都可以建议我一个示例代码,它可以生成显示来自数据集的多个表的数据的水晶报告。

I have tables which are given below
Customers : custId,  custName
Orders : ordID, ordName, amount, custID
I want to generate a report using these two tables which should look like
custID   -  xxxx                                         custName - xxxx
OrderID                  OrderName
1                                 aaa
2                                 bbb
3                                 ccc
can anyone suggest me a sample code which can generate crystal report that displays data from  multiple tables  of a dataset.
 

推荐答案

嗨。如果您使用的是SQL Server,则可以创建存储过程,然后将数据源设置为存储过程名称。例如:

Hi.  If you are using SQL Server, you could create a stored procedure and then set your datasource to the stored procedure name.  For example:

CREATE PROCEDURE [usp_rptCustomerOrders]

AS
SET NOCOUNT ON
SELECT c.CustID,c.CustName,o.OrdId,o。 OrdName,o.Amount
FROM dbo.Customers c INNER JOIN
dbo.Orders o ON c.CustID = o.CustID

CREATE PROCEDURE [usp_rptCustomerOrders]
 
AS
SET NOCOUNT ON
SELECT     c.CustID, c.CustName, o.OrdId, o.OrdName, o.Amount
FROM  dbo.Customers c INNER JOIN
                      dbo.Orders o ON c.CustID = o.CustID


GO

您可以将datsource设置为"rptCustomerOrders"然后,您可以将您的报告分组为客户ID。

You would set your datsource to "rptCustomerOrders" and then you could group your report on the customer id. 

只是想一想......

Just a thought...


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

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