这个日期时间字面值不明白

时间:2016-09-29 04:34:00

标签: sql sql-server visual-studio-2015 crystal-reports

我收到一条错误,上面写着“这个日期时间文字未被理解”

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

如果我删除此行...

AND {tblOffertory.Weekly}=#" & txtOffertory.Text & "#"

...而是使用这一行......

docprint.CrystalReportViewer1.SelectionFormula = "{tblOffertory.Date}=""" & dtpOffertory.Text & """"

...它显示的报告没有数据,只有列。我应该使用什么配方?

0 个答案:

没有答案