【发布时间】:2011-04-21 13:48:33
【问题描述】:
我正在尝试将 C# 生成的 2 个值通过 Crystal 报表传递给 MS SQL 存储过程
到目前为止我有这个代码
string username = Context.User.Identity.Name;
string date = DateTime.Now.ToShortDateString() ;
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath(@"..\admin\CrystalReport1.rpt"));
crystalReport.SetParameterValue("@Username", username);
crystalReport.SetParameterValue("@Date", date);
crystalReport.SetDatabaseLogon("", "", @"dennislaptop-pc\SQLEXPRESS", "healthylifestyledb");
CrystalReportViewer1.ReportSource = crystalReport;
上面的代码在水晶报告生成页面中,问题是当我尝试将@Date 值传递给存储过程时。存储过程运行良好,但我在 C# 中遇到此错误
索引无效。 (HRESULT 异常:0x8002000B (DISP_E_BADINDEX))
任何帮助我如何传递 2 个参数值?
【问题讨论】:
标签: c# crystal-reports parameters