sql - 如何在 Crystal 报表中使用多个存储过程?

标签 sql stored-procedures crystal-reports

我有两个我希望在我的存储过程中使用的存储过程,但是一旦我这样做,它就无法加载并显示错误:“提供的参数无效,未检索到行集。”如果我删除其中任何一个,它就会重新开始工作。

我的 Crystal 报告设置如下:

Report:
  Group By Tenant.ReferedBy
    stored proc here that calculates the tenant's balance

and the second stored proc is in the Select for the report. I only want to select tenant's by a status flag, and I'm getting the status flag from a stored proc.

Neither of the two procedures are linked together in anyway. One returns one value (the one in the select), the other returns multiple (the one in the group by). Neither take any parameters and are both just simple SQL statements stored on the database.

First Proc: GetAllTenantBalances

SELECT (SUM(tblTransaction.AmountPaid) - SUM(tblTransaction.AmountCharged)) AS TenantBalance, tblTransaction.TenantID
    FROM tblTransaction
    GROUP BY tblTransaction.TenantID

第二个过程:[GetTenantStatusID_Current]
SELECT ID FROM tblTenantStatus WHERE Description = 'Current'

谁能告诉我为什么我不能这样做,以及如何解决它?

最佳答案

您可以将第一个 sp 更改为仅汇总“当前”租户。或者,如果您必须保留两个 sp,您将必须找到数据库专家并通过租户 ID 加入它们。

关于sql - 如何在 Crystal 报表中使用多个存储过程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/883705/

相关文章:

mysql - 如何在没有 key 的情况下连接表?

mysql - CONCAT 类别的所有父级

php - 如何将新行的 id 插入到另一个链接表中?

sql - IF/ELSE 取决于存储过程的结果

mysql - 在 MySQL 给定条件下生成所有可能的唯一和随机值

c# - 将报告重新绑定(bind)到新的 XML XSD

crystal-reports - 如何更改 Crystal 报告文件上的数据源类型

sql - SQL Server 2008 r2或PostgreSQL

sql-server - 存储过程和扩展存储过程的区别

c# - Crystal 报表设置数据源