在做VB程序,想用DTPicker控件选择日期,查询Access数据库的数据,数据库的表中有“时间”字段,怎么做?

2024-12-15 08:01:56
推荐回答(3个)
回答1:

Set mrc3 = RunSelect("select * from 温度表1 where 时间 >= '" & DTPicker1.Value & " 00:00:00' and 时间 <= '" & DTPicker1.Value & " 23:59:59'")

回答2:

思路正确,但代码有SQL语法错误, form改成 from

回答3:

Dim mrc3 As ADODB.Recordset
Set mrc3 = RunSelect("select * form 温度表1 where 时间<‘#" & DTPicker1.Value & ”#’“)
Set Form5.DataGrid1.DataSource = mrc3