[英]C# Crystal report argument out of range exception
I am creating a crystal report @c# program but when I execute the report its working at first but when I execute the same report at second time I am having this error. 我正在创建一个水晶报告@ c#program但是当我执行报告时它首先工作,但是当我第二次执行相同的报告时,我遇到了这个错误。
I use view to sql server to retrieve my data. 我使用view to 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();
I am having this error. 我有这个错误。
An unhandled exception of type 'System.ArgumentOutOfRangeException'
occurred in System.Windows.Forms.dll
Additional information: Index 0 is out of range.
then these are the instances 那么这些就是实例
CrystalReport1 rp = new CrystalReport1();
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
reportViewer f3 = new reportViewer();
我想出了我的问题的答案,它提示一个参数异常,因为程序,我通过form.Show()
而不是form.ShowDialog()
调用表单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.