dtpicker进行筛选(between)问题

kjset 2004-10-07 04:55:18
我用SQL数据库

srec.CommandType = adCmdText

srec.RecordSource = "select * from LINGRU where 日期 between '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "'"

在datagrid中显示的是全部数据,根本没筛选?请问怎样解决!
...全文
122 点赞 收藏 4
写回复
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wwqna 2004-10-07
同意楼上
回复
frankwong 2004-10-07
试一下:
srec.CommandType = adCmdText

srec.RecordSource = "select * from LINGRU where 日期 between '" & format( DTPicker1.Value ,"yyyy-mm-dd") & "' and '" & format( DTPicker2.Value,"yyyy-mm-dd") & "'"
回复
kjset 2004-10-07
这样会出错
回复
tztz520 2004-10-07
srec.RecordSource = "select * from LINGRU where 日期 between #" & DTPicker1.Value & "# and #" & DTPicker2.Value & "#"
回复
发动态
发帖子

1180

社区成员

VB 数据库(包含打印,安装,报表)
申请成为版主
社区公告
暂无公告