Skip to Content
author's profile photo Former Member
Former Member

VS2010 open report (with subreport) issue

Hi All :

If the main report have one sub report, and I have define the field link between main report and subreport.

When the vs2010, I have write the code as below

_Cnn.Open();

SqlCommand _cmd = new SqlCommand("SELECT ID, STUDENTNAME, CLASSNUM'", _Cnn);

SqlDataReader _reader = _cmd.ExecuteReader();

DataTable _dt1 = new DataTable();

_dt1.Load(_reader);

_cmd = null;

_reader = null;

_cmd = new SqlCommand("SELECT STUDENTID , CLASSBOOK FROM LIBARYN", _Cnn);

_reader = _cmd.ExecuteReader();

DataTable _dt2 = new DataTable();

_dt2.Load(_reader);

ReportDocument _Report = new ReportDocument();

string _report = @"reportstgetReport.rpt";

_Report.Load(_report);

_Report.SetDataSource(_dt1);

_Report.OpenSubreport("subreport").SetDataSource(_dt2);

crv.ReportSource = _Report;

The reportviewer will prompt to input value of parameter field (but this parameter field is link field between main report and sub report).

How to handle it ?

Michael

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jul 27, 2016 at 06:23 PM

    Hi Michael,

    You have not passed the specific value to the parameter of the Main Report in the application code.

    You need to pass the value before crv.ReportSource = _Report;.

    Go through the developer guide: http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_dg_2010_en.zip

    Also I have attached sample applications. Go to ReportDocument_Object_Model_Tutorials folder. Rename the file by removing the .txt.

    Regards,

    Vinit


    Samples.zip.txt.zip (366.2 kB)
    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Michael,

      Try using my Parameter test app, search for KBA 2281780.

      It can set log on info for main and subreport as well as setting to DS's and then set parameters also.

      One thing to validate, if you export the report to RPT format in your viewer and then open that report in CR Designer does it have values when you refresh the report?

      Please go through the test app in debug mode and watch what is happening to the values.

      It's possible your DataSet is not 100% for the type the report is expecting.

      Don

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.