Set getrsp = cnn.Execute("SELECT * FROM gpsdata where cisu ='" & cisu & "' and Datediff(d,startdate,'" & tmpdate & " ') = 0 ORDER BY 时间") 数据库中startdate字段位DATE型,tmpdate定义的也为DATE型,断点运行时值为"2012-10-19"也是对的,怎么SQL还是查询不到呢?
2、就是我想写个函数
Public Function getrst(cnn As ADODB.Connection) As ADODB.Recordset
然后在下次可以供其他函数调用,比如disp_rst(rst As ADODB.Connection),这样可不可以呢?
因为我现在的代码都是每次要显示的时候都要执行sql语句
Set rs = cnn.Execute("SELECT count(*) FROM gps where Year(startdate) =" & date_Y & " and Month(startdate)=" & date_M & " and Day(startdate)=" & date_D & " and num = " & NumId & "and cisu ='" & cisu & "' "),我想既然都有记录集rst了,就应该可以用函数把它显示出来了吧。
谢谢