我在 VB6 中有一个查询:
"select plate_no from INFO where date_time between #07-10-2012 01:13:17# and #10/10/2012 11:30:25#"
我的 Access 数据库表具有数据类型 Data/Time 的一般格式的列。
如何修改上面的查询以使用如下变量:
Public t1 As Date
Public t2 As Date
我是从记忆中做的,可能需要对其进行调整才能编译:
Public t1 as Date
Public t2 as Date
t1 = #10/07/2012 01:13:17# '7th of October 2012
t2 = #10/10/2012 11:30:25# '10th of October 2012
sql = "select plate_no from INFO where date_time between #" + Format(t1, "YYYY-MM-DD HH:MM:SS") + "# and #" + Format(t2, "YYYY-MM-DD HH:MM:SS") + "#"