locked
How do I go about this? RRS feed

  • Question

  • User1970040472 posted

    Hello,

    Env: VS 2008 / ASP.NET / Microsoft Report Viewer

     

    Here is what I was doing.


    1. Created dataset "A.xsd"

    2. In the datase, created datatable named "B"

    3. Created a report rdlc and designed two charts on it.

     4 Behind code, dtA and dtB are table data for the table schema

    ReportDataSource rdOne = new ReportDataSource
                    ("A_B", dtA);
    ReportDataSource rdTwo = new ReportDataSource
                    ("A_B", dtB);
    ReportViewer1.LocalReport.DataSources.Clear();
    ReportViewer1.LocalReport.DataSources.Add(rdOne);
    ReportViewer1.LocalReport.DataSources.Add(rdTwo);
    ReportViewer1.LocalReport.Refresh();

    It works fine, but same data are displayed in those two charts. Obiviously, I think this is because of the ReportDataSource name.

    Of course, I think I can create another duplicated same table schema of B and  name it B2 in the dataset to use it as a data source like "A_B2"..

    However, is there any way that I can provide different data but using exisiting table schema?

    Just don't want to create bunch of duplicated same table schema with just differnt name...

    Any idea?

     

    Thanks

     

    Wednesday, May 25, 2011 5:06 PM

Answers

  • User1471008070 posted

    Hi,

    It is true you have to create another table, as we could not diplay different table's records into one data region.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 29, 2011 12:50 AM

All replies

  • User2105670541 posted
    well what i understood, if you want to copy the complete structure and data you can use: DataTable _dtCopy=_dtA.Copy(); or just the structure you can use: DataTable _dtClone=_dtA.Clone();
    Wednesday, May 25, 2011 11:09 PM
  • User1970040472 posted

    Thanks for reply, but that's not what I was asking.

    I was asking mapping issue for two charts.

    Two datatable (dtA and dtB) I was using are basically different objects, but same schema.

    So problem is here..

    ReportDataSource rdOne = new ReportDataSource
                    ("A_B", dtA);
    ReportDataSource rdTwo = new ReportDataSource
                    ("A_B", dtB);

    When report source data source name is passed, I think it has to be different name mapping in order to supply different data.

    However, in order to do that, I would need to create another table schema(like B) in the A dataset file, which I want to avoid possibly because it

    is going to be exactly same one like B again.

     

     

     

    Thursday, May 26, 2011 9:58 AM
  • User1471008070 posted

    Hi,

    It is true you have to create another table, as we could not diplay different table's records into one data region.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 29, 2011 12:50 AM