Vb.Net 在两个日期之间搜索 ms 访问

Vb.Net Search between two dates ms access

我正在使用 vb.net Windows 表单申请,我有两个日期选择器,我想在两个日期之间进行过滤... 我试过这段代码:

Me.DBBindingSource.Filter = "[Data ardhjes] BETWEEN " & dtpDataArdhjes.Value.Date & " AND " & dtpDataArdhjesNE.Value.Date

我收到了这个错误:

Additional information: The expression contains unsupported operator 'Between'.

和其他一些代码,但它不起作用.. [Data ardhjes] 在 table 上,dtpDataArdhjes 是来自 table 的 datetimepicker dtpDataARdhjesNe 只是一个日期时间选择器,我想在名为 [Data Ardhjes] 的同一列中的两个日期之间进行搜索 有什么建议吗?

我得到了答案:

Me.DBBindingSource.Filter = String.Format("[Data ardhjes] >= #{0:M/dd/yyyy}# AND [Data ardhjes] <= #{1:M/dd/yyyy}#", _
                                 dtpDataArdhjes.Value, _
                                 dtpDataArdhjesNE.Value)

现在效果很好..

试试这个:

 Me.DBBindingSource.Filter = "[Data ardhjes] BETWEEN " & dtpDataArdhjes.Value.ToString("#yyyy/MM/dd#") & " 
    AND " &  dtpDataArdhjesNE.Value.ToString("#yyyy/MM/dd#")