【问题标题】:Setting multiple datasource for a report in Asp.net在 Asp.net 中为报表设置多个数据源
【发布时间】:2010-03-24 11:12:04
【问题描述】:

我有一个报告,其数据来自两个存储过程。所以我需要设置这两个数据源来生成报告。但是只有一个 SP 的报告,即只有一个数据源可以正常工作。为了设置数据源,我写了这样的代码:


dim reportdocument as ReportDocument

Dim reportPath As String = Server.MapPath("CrystalRpts\Report.rpt")

ReportDocument.Load(reportPath)

'Function for Setting the Connection

SetDBLogonForReport(MyConnectionInfo, ReportDocument)

dim dt1 as datatable=Datasource1

dim dt2 as datatable=Datasource2

dt1.merge(dt2)

reportdocument.setDataSource(dt1)

CrystalReportViewer.ReportSource=reportdocument

***************************************************

But, the report is not generating.it shows the following error

The Report requires additional information

Servername:- Server

Database:- Database

UserID:-

Password:-

但是只有一个的报告 SP,即只有一个数据源有效 正确的。这是什么原因 错误?

我已经创建了这个报告。所以我不能合并两个SPs,因为它可能会刷新报告字段。请建议。

【问题讨论】:

标签: .net asp.net sql stored-procedures report


【解决方案1】:

您只能将一个数据源设置为报告,但最好一次获得所需的所有数据并将该数据源设置为您的报告。

Its better to combine your two Stored procedure to one

【讨论】:

  • @Akthar 我当然同意你的回答,但看看她提到的错误?
  • 但她也写了,如果她只使用一个程序,那么它工作正常。
  • 不,我已经创建了此报告。我无法合并这两个 SP,因为它可能会刷新报告字段。此外,为了将两个数据源放在一起,我将两者合并。看那行,dt1.merge(dt2)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-30
  • 2012-03-07
  • 2017-09-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多