避免在Crystal Report中使用参数提示 [英] Avoid Parameter Prompt in Crystal Report

查看:120
本文介绍了避免在Crystal Report中使用参数提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如何避免可选参数提示?我试过不同的方法。在我的SP中,我将所有参数的默认值设为null。



Hi,

How to avoid Optional parameter prompt? I tried different methods. In my SP I have given default value as null for all the Parameters.

InvoiceReport objReport = new InvoiceReport();
ReportDocument obj1 = new ReportDocument();
obj1.Load(@"C:\Projects\Restaurant.UI\InvoiceDetails.rpt");

if (rbInvoiceStatus.Checked == true)
{
    int statusid=Convert.ToInt32(cmbItems.SelectedValue.ToString());
    obj1.SetParameterValue("@InvoiceNo", DBNull.Value);
    obj1.SetParameterValue("@VendorID", DBNull.Value);
    obj1.SetParameterValue("@FromDate", DBNull.Value);
    obj1.SetParameterValue("@Todate", DBNull.Value);
    obj1.SetParameterValue("@InvoiceStatusID", statusid);
}
objReport.crystalReportViewer1.ReportSource = obj1;
objReport.Show();

推荐答案

Crystal报告中有两个提示,

1.参数提示 - 在Crystal Reports for Visual Studio中禁用参数提示对话框 [ ^ ]

2.登录提示 - C#Crystal Reports动态登录参数 [ ^ ]
There're two prompts in Crystal reports,
1. Parameter prompt - Disabling Parameter Prompt Dialog Box in Crystal Reports For Visual Studio[^]
2. Logon prompt - C# Crystal Reports Dynamic Logon parameters[^]


使用以下代码在代码文件中设置参数



Use the following code to set the parameter in code file

_objReportDocument = new ReportDocument();
_objReportDocument.SetParameterValue(paramName, paramValue);





那么它不会提示你输入参数



then it will not prompt you to enter parameter


这篇关于避免在Crystal Report中使用参数提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆