【问题标题】:How to retrieve dataset in RDLC report where one stored procedure return multiple table如何在 RDLC 报告中检索一个存储过程返回多个表的数据集
【发布时间】:2015-09-22 02:57:57
【问题描述】:

我正在创建一个.rdlc 报告。将有三张桌子展示。

我写了一个存储过程 Like

  select a,b,c from table A
  select a1,b1,c1 from table A1
  select a2,b2,c2 from table A2

主要是我的过程从这三个表中返回数据。

但我无法理解如何在三个单独的数据集中捕获它们。

【问题讨论】:

  • 您可以编写自己的自定义数据提供程序,为 rdlc 提供一个附有所有三个 DataTables 的 DataSet,或者,请参阅以下链接,其中包含一些想法,使用 select 语句从存储过程中提取某些值. stackoverflow.com/questions/1492411/…

标签: sql sql-server asp.net-mvc asp.net-mvc-3 rdlc


【解决方案1】:

你可以划分三个ds并像使用它们

        mySqlDataAdapter.Fill(myDataSet, "STS_rptYarnLedger");

        ReportDataSource datasource = new ReportDataSource("dsSTab1", myDataSet.Tables[0]);
        ReportDataSource datasource1 = new ReportDataSource("dsTab2", myDataSet.Tables[1]);
        ReportDataSource datasource2 = new ReportDataSource("dsTab3", myDataSet.Tables[2]);

        rvYarnStock.LocalReport.DataSources.Clear();
        rvYarnStock.LocalReport.DataSources.Add(datasource);
        rvYarnStock.LocalReport.DataSources.Add(datasource1);
        rvYarnStock.LocalReport.DataSources.Add(datasource1); 

要捕获数据集,您需要经历一个过程,对于每个块(注释掉其他块),您需要分别执行每个块。在将它们放入数据集中后,只需执行完整的过程。

【讨论】:

    猜你喜欢
    • 2015-11-22
    • 1970-01-01
    • 1970-01-01
    • 2020-03-27
    • 1970-01-01
    • 1970-01-01
    • 2012-07-21
    • 2019-12-10
    • 1970-01-01
    相关资源
    最近更新 更多