当前位置:编程学习 > VB >>

vb ado搜索条件在变量里是日期类型?

如题
我想在数据库中查找符合用户输入的纪录
关于日期形的
Dim t1, t2 As Date
t1 = Text1.Text
t2 = Text2.Text
"select * from 表1 where 日期 >= t1 and 日期 <= t2"

希望高手解答 --------------------编程问答-------------------- Dim t1, t2 As Date 
t1 = Text1.Text 
t2 = Text2.Text 
"select * from 表1 where 日期 > = '" & t1 & "' and 日期  <= '" & t2 & "'" 

--------------------编程问答-------------------- 我用的是access数据库这样我用不行 --------------------编程问答-------------------- ACCESS版改成这样:
"select * from 表1 where 日期 >  = #" & t1 & "# and 日期   <= #" & t2 & "#"  --------------------编程问答-------------------- reco = "select * from 表1 where 日期 between " & Chr(35) & Text1.Text & "# and #" & Text2.Text & Chr(35) 

--------------------编程问答-------------------- reco = "select * from 表1 where 日期 between " & Chr(35) & t1 & "# and #" & t2 & Chr(35)  




--------------------编程问答-------------------- "select * from 表1 where 日期 > = #" & Format(t1, "yyyy-mm-dd") & "# and 日期  <= #" & Format(t2, "yyyy-mm-dd") & "#" --------------------编程问答-------------------- 谢谢 --------------------编程问答-------------------- lz要干嘛? --------------------编程问答-------------------- 接分先!
补充:VB ,  VBA
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,