查看: 1177|回复: 7
|
Access Date Type 的问题
[复制链接]
|
|
我用access 2000 database,里面的date field 是用General Date Format,我用
select * from orders where cdate=#15/08/04 11:16:00 PM#
database里确实是有这个时间的资料,我输入的,可是用上面所写的sql statement,却没有result。
请各位帮忙下,谢谢 |
|
|
|
|
|
|
|
发表于 3-9-2005 07:16 PM
|
显示全部楼层
用这
select * from orders where cdate='2004-08-15 11:16:00' |
|
|
|
|
|
|
|
![](static/image/common/ico_lz.png)
楼主 |
发表于 4-9-2005 02:40 PM
|
显示全部楼层
原帖由 max5007 于 3-9-2005 19:16 发表
用这
select * from orders where cdate='2004-08-15 11:16:00'
max5007,试了,还是不可以,我用的是access |
|
|
|
|
|
|
|
发表于 5-9-2005 09:27 AM
|
显示全部楼层
尝试:
select * from orders where cdate=#15/08/04 11:16:0#
另外, 可以的话, 把 cdate 这个名字改一改, 因为 cdate 是 access 的 keywords 之一. |
|
|
|
|
|
|
|
![](static/image/common/ico_lz.png)
楼主 |
发表于 5-9-2005 12:38 PM
|
显示全部楼层
我改了field name,
SELECT * FROM orders WHERE LastDate=#15/08/05 11:16:0#
没有result,这是不是access 的bug? |
|
|
|
|
|
|
|
发表于 5-9-2005 06:04 PM
|
显示全部楼层
没有result,这是不是access 的bug?
Microsoft应该不会做那么大个虫吧 。应该是你的condition 不match罢了。
当在MS-Access 用datetype column 时,我们要很小心。
比如说你的SQL statement assume 的是#MM/DD/YYYY#的format,
但computer date 的 format 是 #DD/MM/YYYY#, 酱你就永远没办法的到你要得result(就算你的SQL和DB 的data 没问题)。
明白吗?
如果你认为的SQL和DB 的data 没问题。不妨留意以上所讲的issue.
P/S: 建议你retrieve 你的data with #YYYY-MM-DD# format.
YYYY-MM-DDformat is safer.
[ 本帖最后由 chinjw 于 5-9-2005 06:06 PM 编辑 ] |
|
|
|
|
|
|
|
![](static/image/common/ico_lz.png)
楼主 |
发表于 6-9-2005 09:32 AM
|
显示全部楼层
做到了
原来是这样
SELECT * FROM orders WHERE LastDate=#2004-08-15 11:16:00 PM#
谢谢大家的帮忙![](static/image/smiley/default/biggrin.gif) |
|
|
|
|
|
|
|
发表于 6-9-2005 09:38 AM
|
显示全部楼层
原帖由 梦游仙境 于 6-9-2005 09:32 AM 发表
做到了
原来是这样
SELECT * FROM orders WHERE LastDate=#2004-08-15 11:16:00 PM#
谢谢大家的帮忙
不用客气~~![](static/image/smiley/default/lol.gif) |
|
|
|
|
|
|
| |
本周最热论坛帖子
|