asp问题:文本格式转为日期格式

来源:百度知道 编辑:UC知道 时间:2024/07/04 03:48:54
己有一个变量&dtfrom& 起始日期 (2008-03-01,类似这样的文本格式)
己有一个变量&dtto& 终止日期 (2008-03-19,类似这样的文本格式)
数据库中rq字段,也是一个文本格式的日期:2008-03-19

我想列出数据库中,起始日期 到 终止日期 之间的记录。。。我原来是这样写的
sql = "select from hy left join hyClub on hy.ID=HyClub.HyID where hyclub.kt='1' and WuliuNumber='"&WuliuNumber&"' and rq>='"&dtfrom&"' and rq<='"&dtto&"' "

可是我的一个朋友说,文本格式的日期,不能比较大小。

请大家帮我一个忙,把这个问题解决一下!
我的是asp程序,,不是.net的

sql = "select from hy left join hyClub on hy.ID=HyClub.HyID where hyclub.kt='1' and WuliuNumber='"&WuliuNumber&"' and DateDiff('d',rq,#"&dtfrom&"#)>0 and DateDiff('d',rq,#"&dtto&"#)<0"

我写的是SQL的语句 跟平台无关