C# Crystal 报表参数超出范围异常

标签 c# sql-server-2005 crystal-reports

我正在创建一个 Crystal 报表 @c# 程序,但是当我第一次执行该报表时它正常工作但是当我第二次执行相同的报表时我遇到了这个错误。

我使用 View 到 sql server 来检索我的数据。

 cmd = new SqlCommand("Select * From referral where referralNo = '" + 
 lblReferral.Text + "' and clientNo = '" + cbClientNo.Text + "'", con);
 cmd.CommandType = CommandType.Text;
 da.SelectCommand = cmd;
 da.Fill(ds, "referral");
 rp.SetDataSource(ds);
 f3.crt.ReportSource = rp;   
 f3.Show();
 rp.Close();

我有这个错误。

 An unhandled exception of type 'System.ArgumentOutOfRangeException' 
 occurred in System.Windows.Forms.dll

 Additional information: Index 0 is out of range.

那么这些是实例

 CrystalReport1 rp = new CrystalReport1();
 SqlDataAdapter da = new SqlDataAdapter();
 DataSet ds = new DataSet();
 reportViewer f3 = new reportViewer();

Error @reviewing the report

最佳答案

我找到了我的问题的答案,它提示参数异常,因为程序,我通过 form.Show() 而不是 form.ShowDialog() 调用表单.

关于C# Crystal 报表参数超出范围异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45869469/

相关文章:

c# - LINQ to SQL 无法创建数据库 [架构权限]

sql - 使用 SQL 查询生成 Crystal 报表

java - Crystal 报表 Eclipse MS Access

c# - 在本地主机上使用 Firefox 运行 WatiN

c# - 如何访问Azure Function中的本地应用程序设置

c# - 访问 Azure 嵌入式二进制资源(FileStream?)

SQL语句根据最新日期选择最新版本数据的值

sql-server - 如何在 SQL Server 2005 中将十六进制字符串转换为二进制?

crystal-reports - 检测 x86/x64 并安装正确的 .msi

c# - App.config 问题与同一解决方案中的许多项目