VB代码求助
Dim a, jidu As Integera = DTPicker2.month - DTPicker1.month
For jidu = 0 To a
conn.Open "DSN=intouch;APP=Microsoft(R) Windows(R) Operating System;WSID=QC2;DATABASE=WWALMDB;Trusted_Connection=Yes" '连接SQL2005
rs(jidu).Open "Select avg(H2S101),avg(PH201),avg(PH701),avg(inCOD),avg(outCOD) from yibiao where time1 like'%" & CStr(DTPicker1.month + jidu) + "/" + "%" + "/" + CStr(DTPicker1.Year) & "%'", conn, adOpenKeyset, adLockOptimistic
For i = 0 To 4
MSHFlexGrid1.TextMatrix(4 + jidu, i + 1) = Format(str(IIf(IsNull(rs(jidu).Fields(i)), 0, rs(jidu).Fields(i))), "0.00") '从第一列开始进行插入数
Next
rs(jidu).Close
conn.Close
Next
这个是用mm/dd/yyyy 格式,SQL是varchar类型记录的日期查询的代码
现在我想把这段改成mm/dd/yyyy 格式SQL Datetime时间类型记录的日期查询的代码,可查询每个月的平均值,该如何改,请高手帮忙一下,谢谢