Wednesday, February 15, 2012

ERROR: Subreport cannot be shown

Hi,

I have a report (rdlc) which has a subreport. I have specified which report to use as my subreport. I created a dataset to pull all data from two tables. One table goes with the main report, the other goes with the subreport. I then created two sqldatasources and configured the first one to pull the data using parameter to fill the main report then configured the other to do the same for the subreport. I then configured my report to work in those two datasource instances. Then when I run my report I get ERROR: Subreport cannot be shown. But my main report section works fine. Also, if I change the report to just use my report that is the subreport, it works fine. I just can't get it to work as a subreport! PLEASE HELP! I am going insane!

I had the same problem, and found a solution. It appears that even if the parameters are named the same, the subreport will not get its parameter value set unless you connect it to the parameter that the main report is using.

Open the main report|||

I had the same problem, and found a solution. It appears that even if the parameters are named the same, the subreport will not get its parameter value set unless you connect it to the parameter that the main report is using.

Open the main report|||Thanks!|||

Hi Billy,

I have done the same thing as mentioned by you. But I am still not able to view the report. The main report goes in some loop. If I run main report & subreport separately then it is running perfectly fine. I have the same list of parameters for the main report as well as for the subreport.

Do I need to do something else besides this? Appreciate your help.

Thanks

Hitesh

|||

Hi, there

I got the same error with you. Just wonder did u solve your problem? I just sent your an email.

contact me atste_chen@.yahoo.com

thanks a lot !

steven

|||

Having the same parameter names will not cause the data to flow from the parent report to the sub report. Did you go through the bullet points above and map the parameter values from the parent report to the child report?

|||

You may need to handle the OnSubreportProcessing event in your code. Build a dataset of the table you want to use and add it to the SubreportProcessingEventArgs of the local report.

Private Sub ReportViewer_SubreportProcessing(ByVal senderAs Object,ByVal eAs SubreportProcessingEventArgs)Dim SubRptConnAs New SqlConnection("Connection string")Dim SubRptSqlCmdTextAs String ="SELECT * FROM Table;"Dim SubRptSqlCmdAs New SqlCommand(SubRptSqlCmdText, SubRptConn)Dim SubRptSqlDAAs New SqlDataAdapter(SubRptSqlCmd)Dim SubRptSqlDSAs New DataSet SubRptConn.Open()SubRptSqlDA.Fill(SubRptSqlDS)SubRptConn.Close()Dim SubRptDSAs New ReportDataSource("Activities_V_LINCS_ItenEventsDetail", SubRptSqlDS.Tables(0))e.DataSources.Add(SubRptDS)End Sub
|||

Has anyone figured this out?

I have my main report and my subreport with a parameter called X. Then on my sub report viewer control thing you place on the main report I have set the parameter to the same name and set the value to be the main report parameters (parameters!x.value).

This last post had a code regarding ReportViewer_SubreportProcessing, where does this go? My sub report is already bound to a table adapter.
Please help this is driving me nuts. I get the report could not be shown error.
Thanks.
-S

|||

I Have The Same Errot The SubreportProcessingEventHandler is fired up and the query Runs O.K. But The Sub Report Isn't Shown up ,

i Think It's Because in The local Report Mode the main report page doesnt refresh it self

No comments:

Post a Comment