问题描述
我使用以下公式收到错误消息此日期时间字面值未被理解:
I get the error saying "This date time literal was not understood" with this formula:
Private Sub btnOPrint_Click(sender As Object, e As EventArgs) Handles btnOPrint.Click
If MsgBox("Print Offertory Record?", MsgBoxStyle.OkCancel, "Print Record") = MsgBoxResult.Ok Then
Dim report As New ReportDocument
report.Load("C:\Users\Paolo\Documents\Visual Studio 2015\Projects\NewMonitoringSystem\NewMonitoringSystem\OffertoryReport.rpt")
docprint.CrystalReportViewer1.ReportSource = report
docprint.CrystalReportViewer1.SelectionFormula = "{tblOffertory.Date}=""" & dtpOffertory.Text & """AND {tblOffertory.Weekly}=#" & txtOffertory.Text & "#"
docprint.CrystalReportViewer1.Refresh()
docprint.Show()
End If
End Sub
但如果我删除LINE
But if I remove the LINE
AND {tblOffertory.Weekly}=#" & txtOffertory.Text & "#"
并使用此LINE 这是我应该使用的:
and use just this LINE which is what i'm supposed to use:
docprint.CrystalReportViewer1.SelectionFormula = "{tblOffertory.Date}=""" & dtpOffertory.Text & """"
显示报告表格,但没有数据,只有列。任何人都可以帮助我使用我只使用日期的公式。谢谢
我尝试了什么:
我试过提到的代码以上但无济于事。
It show the report form but has no data in it, just the columns. Can anyone help me with the formula where I only use the Date. Thanks
What I have tried:
I tried the codes mentioned above but to no avail.
推荐答案
totext({tblOffertory.Date})
希望,它有帮助:)
如果它没有帮助或我在这里遗漏了什么,请告诉我。
Hope, it helps :)
Please let me know if it doesn't help or if I am missing something here.
docprint.CrystalReportViewer1.SelectionFormula = "ToText(CDate({tblOffertory.Date}))= ToText(CDate(""" & dtpOffertory.Text & """))"
此代码有效。感谢@Suvendu的想法
This code worked. Thanks for the idea @Suvendu
这篇关于使用visual studio需要有关水晶报告公式的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!