简体   繁体   English

水晶报表,子报表

[英]Crystal Reports, Sub Reports

I have a main reports which I used for accounting purposes and I built an sub report and attach to it. 我有一个主要报告,用于会计目的,并建立了一个子报告并附加到该报告。 I want to update the sub report using a query so every time I open the main report the sub report will be updated based on the query I will used. 我想使用查询来更新子报表,因此每次我打开主报表时,都会根据要使用的查询来更新子报表。 But I don't know how to add new command. 但是我不知道如何添加新命令。

I'm using Visual Studio 2010, SQL Server 2008 and Crystal Reports for Visual Studio. 我正在使用Visual Studio 2010,SQL Server 2008和Visual Studio的Crystal Reports。

If I understood your question.... 如果我理解您的问题...

What you should do is, create query/stored procedure which accept a parameter from the main report so every time sub report will display data based on main report. 您应该做的是,创建查询/存储过程,该查询/存储过程接受主报表中的参数,以便每次子报表将基于主报表显示数据。

Once you insert the sub-report to the main, 将子报表插入主报表后,

Right click on sub-report select Change sub-report links and tick the "Select data in subreport based on field" then you can select which parameter/field from Main report need to be linked with your sub-report parameter 右键单击子报表,选择“更改子报表链接”,然后选中“根据字段选择子报表中的数据”,然后可以从“主报表”中选择需要与子报表参数链接的参数/字段

Hope this helps 希望这可以帮助

Well, this is an old post and probably you have already figured it out....And I am not sure what you mean by "..a query that will be based on the selected date of users" but maybe someone will find it helpfull.. 好吧,这是一篇旧文章,可能您已经知道了...。而且我不确定“ ..将基于所选用户日期的查询”的意思,但也许有人会找到它乐于助人的..

Right click on subreport>Edit Subreport> Database> Database Expert> under My connections or under thr DB that you're using> Add Comand. 右键单击“我的连接”下或您正在使用的数据库下的子报表>“编辑子报表”>“数据库”>“数据库专家”>“添加命令”。 You can add your own sql command and all.. 您可以添加自己的sql命令和所有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM