【问题标题】:my code is as shown and i get this error "The remaining text does not appear to be part of the formula">我的代码如图所示,我收到此错误“剩余文本似乎不是公式的一部分”>
【发布时间】:2018-12-10 18:15:14
【问题描述】:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 处理 Me.Load

    reportdoc1.Load(Server.MapPath("~\RepVoucherchq.rpt"))
    CrystalReportViewer1.ReportSource = reportdoc1
    ConnectionInfo()

    Dim user_brno As String = CType(Session("userBrn"), String)
    Dim date_from As String = CType(Session("date_from"), String)
    Dim date_to As String = CType(Session("date_to"), String)

    reportdoc1.RecordSelectionFormula = "{VEWVoucherchq.vocdate} between '" + date_from + "' and '" + date_to + "'  and {VEWVoucherchq.chqbrNo} = " + user_brno
    CrystalReportViewer1.RefreshReport()

End Sub

【问题讨论】:

  • 更多详情?这个问题太简单了。

标签: asp.net vb.net crystal-reports


【解决方案1】:

我在这台计算机上没有 Visual Studio 来完全测试这个,但我认为你的语法在你的记录选择公式中是关闭的。

试试这个:

reportdoc1.RecordSelectionFormula = "{VEWVoucherchq.vocdate} in '" + date_from + "' to '" + date_to + "' and {VEWVoucherchq.chqbrNo} = " + user_brno

Crystal Reports 不支持您使用的 between/and 语法以您想要的方式评估日期。支持的语法是{eval_date} IN {start_Date} to {end_Date}

您的date_fromdate_to 字段是字符串数据类型而不是日期或日期时间数据类型时,您也可能会遇到问题。如果这是一个问题,您将需要通过函数将值传递以将它们正确转换为日期。

这样就足够了:

reportdoc1.RecordSelectionFormula = "{VEWVoucherchq.vocdate} in Date('" + date_from + "') to Date('" + date_to + "') and {VEWVoucherchq.chqbrNo} = " + user_brno

如果您需要 DateTime 而不是 Date 数据类型,请将 Date() 函数替换为 DateTime() 函数。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-12
    • 1970-01-01
    • 2021-08-19
    • 1970-01-01
    相关资源
    最近更新 更多