vb关于时间段查询(高追加分)

来源:百度知道 编辑:UC知道 时间:2024/06/14 08:08:27
数据库中有字段"riqi","shijian",我使用四个DTPicker控件,组成例如:从2007年12月1日5时到2007年12月2日6时的查询,请问查询语句怎么写.

两个字段还不会,用一个字段是这样的:

sql = "select * from 表 where riqi between #" & DTPicker1.Value & "# and #" & DTPicker2.Value + "#)"

VSFlexGrid1.Rows = 1
'VSFlexGrid1.Redraw = flexRDBuffered
Msql = "select rxsj,sqr,xybm,zjhm,bmf,phone,cx,pxfs,address,tjr,zt from txyda where rxsj >='" & DTPicker1.Value & "' and rxsj<='" & DTPicker2.Value & "' and zt<>'撤消'"
Call InsertData(Msql)
Msqlb = "select sum(zje) as fkjex from txyda where rxsj >='" & DTPicker1.Value & "' and rxsj<='" & DTPicker2.Value & "' and zt<>'撤消'"
Call inserthj(Msqlb)
VSFlexGrid1.ZOrder 0
只做参考...