How to give parameter to datasource of subreport

Stimulsoft Reports.NET discussion
Post Reply
vencaq
Posts: 1
Joined: Fri Sep 18, 2009 5:33 am

How to give parameter to datasource of subreport

Post by vencaq »

Hello. Is any possibility to give parameter to datasource of subreport? I have report which contains subreport. The subreport is using different datasource which needs parameter to execute. For example datasource of the main report writes out three rows and I need to give values from column paramID to datasource of the subreport as parameters.

Thanks.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

How to give parameter to datasource of subreport

Post by Jan »

Hello,

Please check attached report.

Thank you.
Attachments
229.SQLSubReportWithParameters.mrt
(27.68 KiB) Downloaded 718 times
ZoliNewUser
Posts: 5
Joined: Fri Jan 29, 2010 4:44 am

How to give parameter to datasource of subreport

Post by ZoliNewUser »

Hi Jan,
I have the same problem.
I have created a Report-Subreport by your Sample.
There are two Tables
Table1: Invoices tabble contains main infos as lngInvoiceID, lngCustomerID,...
Table2: Articles table contains several things what customer bought.// lngInvoiceID, lngArticleID...
I want to print concrete invoice with main infos and all articles what it contains.

Table1: select * from Invoices where lngInvoiceID = @InvID //lngInvoiceID included
Table2: select * from Articles where lngInvoiceID = @AInvID
Table2 has a parameter @AInvID =Table1.lngInvoiceID

Report:
Page1.DataBand1.DataSource = Table1 and Has a Supreport1
Subreport1.DataBand2.DataSource = Table2
Subreport1.DataBand2.MasterComponent = DataBand1 // It is Page1.DataBand1, I thing it is correct

In the application i give the @InvID parameter to the Report
Report[@InvID] = 1111;
It's OK, but the Report prints only main infos of Table1, Subreport1 is not printed.
In the SQL Server Profiler (MSQL) I could'nt find anything about SQl query of Subreport1

What i do wrong?

Thanks.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How to give parameter to datasource of subreport

Post by Edward »

Hi

Could you please send us a sample application to support[at]stimulsoft.com for reproducing of the problem? If possible, please attach a necessary data too.

Thank you.
ZoliNewUser
Posts: 5
Joined: Fri Jan 29, 2010 4:44 am

How to give parameter to datasource of subreport

Post by ZoliNewUser »

Hi Edward,

I have figured it out.
I have to set the Table2.ReconnectOnEachRow = true;
I'm new user.
Could you make a help file like as general window help, in what the user can search by content, index...?
I thing, it makes the beginning easer for new users.

Thank you.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How to give parameter to datasource of subreport

Post by Edward »

Hi

Thank you for your feedback.

Please download chm files you requested from the following page:

http://stimulsoft.com/Documentation.aspx

also you always can search the forum :)

Thank you.
Post Reply