如果你的 posttime 的默认值是 NOW ,那么数据库中 posttime 字段存储的值类似 2005-11-30 12:00:25 如果你用 SQL select thread_title,threadID from JB_thread where postuserid=428 and (posttime BETWEEN #2005-11-01# and #2005-11-30#) 来搜索值,那么 JET DB 会自动给你加上 select thread_title,threadID from JB_thread where postuserid=428 and (posttime BETWEEN #2005-11-01 00:00:00# and #2005-11-30 00:00:00#) 00:00:00 你想不要都不行。解决方法是 直接写 SQL 代码如下 select thread_title,threadID from JB_thread where postuserid=428 and (posttime BETWEEN #2005-11-01 00:00:00# and #2005-11-30 23:59:59#) 或者 select thread_title,threadID from JB_thread where postuserid=428 and format(posttime,"yyyy-mm-dd")>='2005-11-01' and format(posttime,"yyyy-mm-dd")<='2005-11-30' 注意, FORMAT 函数需要 ACCESS DRIVER 支持,如果你是 vb+JETDB 等方法开发,可能不支持。 |