带有错误的水晶报告:此处需要数字范围

发布于 2024-10-10 00:56:24 字数 1869 浏览 6 评论 0原文

我正在使用水晶报表,因为我使用如下代码将 SQL 数据显示到水晶报表中,

string req = "{View_EODPumpTest.ROId} IN " + str + " AND " + "({View_EODPumpTest.RecordCreatedDate}>=date(" + fromDate.Year + " , " + fromDate.Month + " , " + fromDate.Day + ")" + "AND" + "{View_EODPumpTest.RecordCreatedDate}<=date(" + toDate.Year + " , " + toDate.Month + " ," + toDate.Day + " ))";

ReportDocument rep = new ReportDocument();
rep.Load(Server.MapPath("PumpTestReport.rpt"));

DateTime fromDate = DateTime.Parse(Request.QueryString["fDate"].ToString());
                DateTime toDate = DateTime.Parse(Request.QueryString["tDate"].ToString());
                CrystalReportViewer_PumpTest.ReportSource = rep;
                //CrystalReportViewer1.SelectionFormula = str;
                rep.RecordSelectionFormula = str;
                CrystalDecisions.CrystalReports.Engine.TextObject from = ((CrystalDecisions.CrystalReports.Engine.TextObject)rep.ReportDefinition.ReportObjects["txtFrom"]);
                from.Text = fromDate.ToShortDateString();
                CrystalDecisions.CrystalReports.Engine.TextObject to = ((CrystalDecisions.CrystalReports.Engine.TextObject)rep.ReportDefinition.ReportObjects["txtTO"]);
                to.Text = toDate.ToShortDateString();
                //Session["Repo"] = rep;
                CrystalReportViewer_PumpTest.RefreshReport();

运行我的应用程序后,它执行得很好,没有异常,但我遇到了这样的错误,

A number range is required here. Error in File C:\DOCUME~1\Delmon\LOCALS~1\Temp\PumpTestReport {14E557A7-51B3-4791-9C78-B6FBAFFBD87C}.rpt: Error in formula . '{View_EODPumpTest.ROId} IN ['15739410','13465410'] AND ({View_EODPumpTest.RecordCreatedDate}>=date(2010 , 12 , 1)AND{View_EODPumpTest.RecordCreatedDate}<=date(2010 , 12 ,25 ))' A number range is required here.

错误。

我将为此做什么?

请帮忙,

提前致谢

I am using the crystal report, in that i am using code like below to show the SQL data into the crystal report,

string req = "{View_EODPumpTest.ROId} IN " + str + " AND " + "({View_EODPumpTest.RecordCreatedDate}>=date(" + fromDate.Year + " , " + fromDate.Month + " , " + fromDate.Day + ")" + "AND" + "{View_EODPumpTest.RecordCreatedDate}<=date(" + toDate.Year + " , " + toDate.Month + " ," + toDate.Day + " ))";

ReportDocument rep = new ReportDocument();
rep.Load(Server.MapPath("PumpTestReport.rpt"));

DateTime fromDate = DateTime.Parse(Request.QueryString["fDate"].ToString());
                DateTime toDate = DateTime.Parse(Request.QueryString["tDate"].ToString());
                CrystalReportViewer_PumpTest.ReportSource = rep;
                //CrystalReportViewer1.SelectionFormula = str;
                rep.RecordSelectionFormula = str;
                CrystalDecisions.CrystalReports.Engine.TextObject from = ((CrystalDecisions.CrystalReports.Engine.TextObject)rep.ReportDefinition.ReportObjects["txtFrom"]);
                from.Text = fromDate.ToShortDateString();
                CrystalDecisions.CrystalReports.Engine.TextObject to = ((CrystalDecisions.CrystalReports.Engine.TextObject)rep.ReportDefinition.ReportObjects["txtTO"]);
                to.Text = toDate.ToShortDateString();
                //Session["Repo"] = rep;
                CrystalReportViewer_PumpTest.RefreshReport();

after running my application it executes fine with no exception but such error i am getting,

A number range is required here. Error in File C:\DOCUME~1\Delmon\LOCALS~1\Temp\PumpTestReport {14E557A7-51B3-4791-9C78-B6FBAFFBD87C}.rpt: Error in formula . '{View_EODPumpTest.ROId} IN ['15739410','13465410'] AND ({View_EODPumpTest.RecordCreatedDate}>=date(2010 , 12 , 1)AND{View_EODPumpTest.RecordCreatedDate}<=date(2010 , 12 ,25 ))' A number range is required here.

error.

what i will do for this?

Please help,

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

物价感观 2024-10-17 00:56:24

您尚未在代码示例中包含“str”的定义,但我猜它是一组以逗号分隔的值。为了让 Crystal 解释这一点,您必须将值范围放在 [ 和 ] 内,而不是您在 SQL 中可能使用的标准 ( 和 )。例如,

{View_EODPumpTest.ROId} IN [1,2,3,4,5,6]

You've not included the definition of 'str' in your code sample, but I'd guess that it's a comma-separated set of values. For Crystal to interpret this you have to put the value range inside [ and ], not the standard ( and ) you might use in SQL. Eg,

{View_EODPumpTest.ROId} IN [1,2,3,4,5,6]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文