我是在程序中执行sql语句,而 set date to ansi 这个命令是不是不能被当做sql语句执行啊。
在下列查询语句中加入 set date to ansi是报错的
odCommand.CommandText = "set date to ansi;select CTOT(购电时间) as ddate from " + mdbPath + " where CTOT(购电时间)>" + date+ "";
既然数据表中存储为两列,查询也用两个条件 and 操作即可,不用拼接
tQuery = {^2015/1/1 10:11:12}
text to cc textm noshow
declear @date char(8), @time char(8)
set @date = '<<dtos(tQuery)>>'
set @time = '<<ttoc(tQuery,2)>>'
select * from 表 where 日期 > @date and 时间 > @time
endtext
sqlexec(hConnect, cc, '查询结果')