使用INNER JOIN从多个表创建报表 [英] Create report from multiple tables using INNER JOIN

查看:64
本文介绍了使用INNER JOIN从多个表创建报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用visual basic(VS2010)。我有三个基于多对多关系的表。我已成功在存储过程中编写SQL语句来获取数据。现在我想要的是将这些数据放入报告(.rdlc)。看看
sql语句:


 
SELECT c.LeaseeName,a.LeasedFrom,a.LeasedTo,a.PaymentDate,b.LeasedLandArea,b.YearlyRentRate
FROM LandRentCollection AS a INNER JOIN
LeasedLandArea AS b ON a.LeasedLandID = b.LeasedLandID INNER JOIN
LandLeaseeDescription < span style ="color:Blue;"> AS c ON b.LeaseeID = c.LeaseeID
WHERE (a.LandRentCollectionID = @LandRentCollectionID)

解决方案

报告引擎对您的查询一无所知。它只知道你给它一个数据数组。您将加入的数据放入报表中的方式与加入前将数据放入报表的方式相同。如果你给它一个具有更多属性的对象数组,那么
你可以绑定到报表设计器中的更多字段,但设置数据的界面是相同的。


顺便说一下,报表引擎不属于Windows窗体或ASP.Net,但它支持这些库。如果您想讨论报告控件,请访问 http:// social。 msdn.microsoft.com/Forums/en-US/vsreportcontrols/threads


I am using visual basic (VS2010). I have three many-to-many relationship based tables. And I've successfully written the SQL statements in stored procedures to fetch the data. Now what I want is to put that data into a report (.rdlc). Take a look at the sql statement:

SELECT c.LeaseeName, a.LeasedFrom, a.LeasedTo, a.PaymentDate, b.LeasedLandArea, b.YearlyRentRate
FROM LandRentCollection AS a INNER JOIN
LeasedLandArea AS b ON a.LeasedLandID = b.LeasedLandID INNER JOIN
LandLeaseeDescription AS c ON b.LeaseeID = c.LeaseeID
WHERE (a.LandRentCollectionID = @LandRentCollectionID)

解决方案

the report engine knows nothing about your query. It only knows you give it an array of data. You put the joined data into the report the same way you put the data into the report before joining. If you give it an array of objects with more properties, then you can bind to more fields in the report designer, but the interface of setting the data is the same.

By the way the report engine does not belong to Windows Forms or ASP.Net, though it supports those libraries. If you want to discuss the report controls, visit http://social.msdn.microsoft.com/Forums/en-US/vsreportcontrols/threads


这篇关于使用INNER JOIN从多个表创建报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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