注册 登录
编程论坛 ASP技术论坛

Access日期/时间问题

wxm198427 发布于 2008-09-22 15:57, 1425 次点击
我做的是用三个下拉框分别选年月日,向Access数据库中写进去日期,我在数据库中选的是日期/时间数据类型,各种时间日期格式都试过了,但就是写进去的日期跟表单提交的不同,而是1905什么什么的,比方我在表单中选2008几月几日,提交后在数据库中就是1905什么的,为什么啊???什么原因呢??该如何解决呢?请各位大虾赐教!!!!
6 回复
#2
wangjianlin20082008-09-22 20:16
Access日期/时间问题
year = Request("year")
month = Request("month")
day = Request("day")
date = DateSerial(year, month, day)

然后就可以将date加入到数据表中对应字段了!
#3
wxm1984272008-09-22 21:15
是这样啊,以前不知道,真的thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!thank you !!
#4
wxm1984272008-09-24 17:15
还是不行啊大哥!!!
#5
欧阳学者2008-09-24 18:38
按一楼的做法,你把数据库时间改成短日期格式,或者把你看看date = DateSerial(year, month, day)
这个 显示出来是什么格式就把数据库日期改成什么格式。只要格式一样应该可以正常写入
#6
lili06102008-09-25 09:46
如果是3个下拉框
可以用一楼的
year1 = Request("year")
month1 = Request("month")
day1 = Request("day")
yearmonth=year1&"-"&month1&"-"&day1
看这样行不行
#7
wxm1984272008-09-25 10:29
谢谢6楼的哥们,我按你的方法成功了,谢谢,以后还请多多指教!!!谢谢
1