【问题标题】:Viewing a dataset with Microsoft Report Viewer使用 Microsoft Report Viewer 查看数据集
【发布时间】:2009-08-04 12:24:16
【问题描述】:

我有一个数据集,它使用存储过程来获取数据。
我已经填写了数据集,一切正常。当我使用调试时,我可以看到数据集不是空的,但我无法使用 Microsoft Report Viewer 查看它。

这是我的代码:

private void frmPrint_Load(object sender, EventArgs e) {

    this.reportViewer1.RefreshReport();
    reportViewer1.LocalReport.DataSources.Clear();

    GetCauseMachineMatrixTableAdapter adapter = new GetCauseMachineMatrixTableAdapter();
    QpNibrolDataSet dataset = new QpNibrolDataSet();
    adapter.Fill(dataset.GetCauseMachineMatrix, this.start, this.end);

    DataTable DT = dataset.Tables[0];

    ReportDataSource reportdatasource = new ReportDataSource();
    reportdatasource.Name = "RDS_NAME";
    reportdatasource.Value = DT;

    reportViewer1.LocalReport.DataSources.Add(reportdatasource);
    reportViewer1.LocalReport.Refresh();
    reportViewer1.RefreshReport();
}

表格在说

未指定报表定义的来源

我做错了什么?

我不使用rdlc,因为当我尝试查看我的数据集时,没有显示列名;我使用的存储过程需要参数。

【问题讨论】:

    标签: c# reporting-services


    【解决方案1】:

    如果您不使用 RDLC 文件,ReportViewer 控件定义了什么需要在屏幕上呈现?

    【讨论】:

    • 但是当我试图将数据源添加到 rdlc 文件时。它没有显示来自 iam 使用的数据集的任何列,并且数据集需要参数(存储的过程)。我能做点什么吗?请帮忙。
    • 您可以尝试强类型化您的数据表。在您的数据集中,您将拥有一个可在 RDLC 文件中使用的强类型数据表。
    【解决方案2】:

    在您的 rdlc 文件中,您必须添加数据集,您的数据名称必须是“RDS_NAME”。首先你必须指向你的 rdlc 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-01
      • 1970-01-01
      • 2011-02-15
      相关资源
      最近更新 更多