NutzCN Logo
问答 急求!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
发布于 1981天前 作者 qq_3b715732 1251 次浏览 复制 上一个帖子 下一个帖子
标签:

observer="observe_time";
Cnd cnd = Cnd.NEW();
cnd.and("station_id", "=", station.getStation_id());
cnd.and(observer, ">=",datestart);
cnd.and(observer, "<=", dateend);
cnd.and(stationType.getArrival_report_status(), "!=", "1");
cnd.getOrderBy().desc(observer);
其中observer在数据库中是timestamp类型,dateend和datestart是datetime格式的string,我已将dateend和datestart转换成timestamp类型,可是一直报错:
CaseMessage=ERROR: operator does not exist: smallint = character varying
建议:No operator matches the given name and argument type(s). You might need to add explicit type casts.
如何解决

6 回复

看这标题就不想回

为什么我把类型转过去了,和数据库的类型相同了,却还是报错

mysql数据库?

cnd.and(stationType.getArrival_report_status(), "!=", "1");

这句是什么东西, getArrival_report_status返回的是属性名??? 写反了?

输出的是 1 != "1" 吧?

其他的sql没问题主要问题在这里
cnd.and(observer, ">=",datestart);
cnd.and(observer, "<=", dateend);
observer是timestamp类型(PostgreSQL数据库),datestart(String 类型)和dateend(String 类型)转换为timestamp类型了,报错
CaseMessage=ERROR: operator does not exist: smallint = character varying
建议:No operator matches the given name and argument type(s). You might need to add explicit type casts.

把cnd.and(stationType.getArrival_report_status(), "!=", "1");注释掉试试

来自炫酷的 NutzCN

添加回复
请先登陆
回到顶部