直接设置数据源时,如何防止Crystal Reports请求凭据/参数? [英] How to prevent Crystal Reports from requesting credentials/parameters when setting the datasource directly?
问题描述
我已经使用反射来提取Crystal Report正在使用的sql查询。然后,我(非常仔细地)使用提取的sql填充数据集,然后该IO通过SetDataSource方法绑定到我的ReportDocument对象。所有这一切都进行得很顺利,但是每当我尝试查看或导出报告时,都要求我提供我的凭据/参数值,这违背了手动查询/绑定数据的目的。
I've used reflection to extract the sql query being used by a Crystal Report. I then use this extracted sql (very carefully) to fill a dataset, which IO then bind to my ReportDocument object via the SetDataSource method. All this goes smoothly, but whenever I'm trying to view or export my report, it requires that I provide my credentials / parameter values, which defeats the purpose of querying/binding my data manually.
当我将报告数据推送到报告中时,是否有任何方法可以提供凭据/参数(即,我是否可以使报告不直接从数据库中刷新?),我尝试设置保存数据值,但似乎无济于事。
Is there any way around having to provide credentials / parameters when my report data is being push into the report (i.e. can I get the report to not refresh istself from the database directly?) I've tried setting the "save with data" value, but it doesn't seem to help.
推荐答案
也许可以提供帮助:
ReportDocument cryReportDocument = .......;
cryReportDocument.SetDatabaseLogon("userName", "password");
cryReportDocument.SetParameterValue("parameterName", value);
CrystalReportViewer1.ReportSource = cryReportDocument;
这篇关于直接设置数据源时,如何防止Crystal Reports请求凭据/参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!