且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在datagridview中显示选定的行到crystal报表

更新时间:2023-01-13 20:24:58

第一个问题是您在不加载报告的情况下设置RecordSelectionFormula。

首先加载报告。

First problem is that you are setting the RecordSelectionFormula without loading the report.
Load the Report first.
Dim rptDoc as New ReportDocument
rptDoc.Load("path to my Report document")



删除SQL命令&数据适配器,因为它们不是必需的 - Crystal将为您处理连接数据库。



其次,您需要使用


Delete the SQL Command & Data Adapter as they are not required - Crystal will handle connecting to the database for you.

Secondly, you will need to use

report.SetParameterValue("paramName", paramValue)

填充Stored Procedure参数而不是RecordSelectionFormula



请注意:Crystal Reports不支持存储过程导致的多个表 - 请参阅;

Crystal Reports - 具有多个结果集的存储过程 [ ^ ]



亲切的问候

to populate the Stored Procedure parameter instead of RecordSelectionFormula

Please note: Crystal Reports does not support multiple tables as a result from a Stored Procedure - refer;
Crystal Reports - Stored Procedure with multiple result sets[^]

Kind Regards