如何在Crystal Report usingvb.net中按日期查询BETWEEN

时间:2012-07-30 02:59:42

标签: vb.net visual-studio-2010 vb.net-2010 crystal-reports-2008 crystal-reports-2010

有人可以帮忙修改此RecordSelectionFormula吗?这是一个错误,有日期格式...

数据库的日期值为:

data type = datetime (yyyy-mm-dd)

datetimepicker is formatdatetime(now,vbshortdate)

我的代码片段是:

"{tblTimeLog.dtr_name}='" & cboName.Text & "' and 
{tbltimelog.dtr_datelog} Between '" & DateValue(DateTimePicker1.Text) & 
"' AND '" & DateValue(DateTimePicker2.Text) & "'"

我的代码的第一行(dtr_name to cboname)是正确的;我检查了一下。但我认为问题在于过滤日期..

1 个答案:

答案 0 :(得分:1)

将您的查询更改为

"{tblTimeLog.dtr_name}='" & cboName.Text & "' and {tbltimelog.dtr_datelog}
in '" & DateValue(DateTimePicker1.Text) & "' to '" & 
DateValue(DateTimePicker2.Text) & "'"