我需要使用特定日期过滤我的报告 有谁可以帮我调试这个?
错误是:"此处需要日期时间"
这是代码
Dim ds As DateTime = Convert.ToDateTime(dp_Exp.Text)
Dim de As DateTime = Convert.ToDateTime(dp_Exp.Text).AddDays(1)
frm_ReportMember.CrystalReportViewer1.Enabled = True
frm_ReportMember.CrystalReportViewer1.ReportSource = "C:\Users\Paolo\Desktop\UpdatedComputerized\ComputerizedMembership\WindowsApplication1\ReportMember.rpt"
frm_ReportMember.CrystalReportViewer1.SelectionFormula = "{RegularMember.PromoCode} = '" _
& cmb_Promo.SelectedItem.ToString & "'" & " AND {RegularMember.DateExpiry} >= #" & dp_Exp.Value.Date.ToString("MM/dd/yyyy") _
& "# AND {RegularMember.DateExpiry} < #" & dp_Exp.Value.Date.AddDays(1).ToString("MM/dd/yyyy") & "#"
frm_ReportMember.CrystalReportViewer1.Refresh()
frm_ReportMember.CrystalReportViewer1.RefreshReport()
frm_ReportMember.Show()
答案 0 :(得分:0)
您的{RegularMember.DateExpiry}
应该是一个日期时间字段,并且您正在向其传递ToString("MM/dd/yyyy")
值。这可能会导致它。
尝试以这种方式格式化{RegularMember.DateExpiry},然后传递它:
string.format("DateTime({0:yyyy, MM, dd, HH, mm, ss})", {RegularMember.DateExpiry});