C# Crystal 报参数超出范围异常
C# Crystal report argument out of range exception
我正在创建一个 crystal 报告 @c# 程序,但是当我第一次执行该报告时它是有效的,但是当我第二次执行相同的报告时我遇到了这个错误。
我使用 sql 服务器的视图来检索我的数据。
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()
.
调用了程序
我正在创建一个 crystal 报告 @c# 程序,但是当我第一次执行该报告时它是有效的,但是当我第二次执行相同的报告时我遇到了这个错误。
我使用 sql 服务器的视图来检索我的数据。
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()
.