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

About subreport problem in Version (13)

Dear Sir :

Good day, today, I have a report which link with Sub Report, When I define one of "Report Field" from Main report link to sub report "Field"

The Sub report will auto create the Parameter Field [Pm-REPORTDATA.MASTERID]. This Parameter Field come from the table field [MASTERID] of main report.

When I use vs2010 to run the report, The report viewer always prompt me to input value on this Sub Report Parameter.[MASTERID]. Could I know how to prevent this prompt ?

Thanks for your help

Michael

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Jul 27, 2016 at 02:08 PM

    Pass the value before previewing.

    Search for KBA 2281780, links to a doc with a Parameter test app I wrote.

    Try that and see if it works

    Don

    Add a comment
    10|10000 characters needed characters exceeded

    • Ah, in previous versions the DB logon info would Propagate to the subreport, it worked when the main and Sub DB info was the same but caused issues when they were not so Propagate no longer works that way. You need to set the log on info for the subreport.

      The KBA I posted above has routines for logging onto the subreport, you have to use that now.

      Don

  • author's profile photo Former Member
    Former Member
    Posted on Jul 28, 2016 at 09:42 AM

    Dear Don :

    Thanks for your advice, but still cannot be help for my case, I think I just miss some thing for this report. Actually, When I make a report and add a subreport, I select the subreport and right click to choose "Change SubReport Links.." and assign the report field (or fomula field) from main report.and check the "Select Data in subreport based on field:"

    The report SubReport Parameter field to use , will auto create the Parameter Field

    (Name as ?Pm-StudentMaster.ID")

    When I run the program, the program will pop up the window and prompt to input PM-STUDENTMASTER.ID

    Before crv.ReportSource = _Report;

    I have do

    mainreport.SetDataSource(dt_MasterTable);

    mainreport.OpenSubreport("BOOKINGRECORD").SetDataSource(dt_ChildTable);

    And follow the advice, to set report connectinfo to sql server, and add the code

    crTable.ApplyLogOnInfo(crtablelogoninfo);

    But, it still not work, so can you advise how to solve it ?

    Thanks for your help

    Michael


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 28, 2016 at 04:18 PM

    Hi Don :

    Even I set the studentid as below it still prompt

    For more information, Table in main report is ID, STUDENTNAME, CLASSNUM, AGE

    Table in SubReport is ID, STUDENTID, BORROWBOOK, DUEDAY

    For the field mapping I just mapping Master Table Field [ID] to Subreport Field [STUDENTID], and I can success to do preview report in preview mode (without prompt). Only if I run the program, the report viewer always prompt to input (?Pm-StudentMaster.ID)

    So if I have not complete the link of UI, can you advise how to complete it ?

    Thanks for your help

    Michael


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Don Williams

      Dear Don:

      The database is SQLServer Express (ver 2014)

      I have sqlcommand to get sql statement as below

      SqlCommand _cmd = new SqlCommand("SELECT * FROM STUDEMTMASTER", _Cnn);

      SqlDataReader _reader = _cmd.ExecuteReader();

      DataTable _dt1 = new DataTable();

      _dt1.Load(_reader);

      _cmd = null;

      _reader = null;

      _cmd = new SqlCommand("SELECT * FROM BOOKRECORD", _Cnn);

      _reader = _cmd.ExecuteReader();

      DataTable _dt2 = new DataTable();

      I have test , and get one case , If the subreport.datasource = _dt2, The report preview have no proble, but the reportviewer only show the first column [id]. for other column field have not show.

      if that have missing inside?

      Thanks

      Michael

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.