如果你的 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 等方法開發,可能不支持。 |