注册 登录
编程论坛 PowerBuilder

[求助]按日期检索的语句,总是出错

gdyuer 发布于 2007-06-13 17:41, 1611 次点击

dw_1.setfilter("djrq>='+date(em_1.text)+' and djrq<='+date(em_2.text)+'")
dw_1.filter()

出错提示是:TYPES OF EXPRESSIONS MUST MATCH.

但是
date ls_dtstart,ls_dtend

ls_dtstart=date(em_1.text)
ls_dtend=date(em_2.text)

SELECT * FROM CLGL_ZC a WHERE a.djrq>=:ls_dtstart and a.djrq<=:ls_dtend

却能执行到正确结果

3 回复
#2
langzping2007-06-13 21:17
dw_1.setfilter("djrq>='"+date(em_1.text)+"' and djrq<='"+date(em_2.text)+"'")
dw_1.filter()
#3
gdyuer2007-06-14 07:55
楼上的,不好用

根本不能保存:
(0004)ERROR C0011: INCOMPATIBLE TYPES IN EXPRESSION:STRING,DATE
#4
gdyuer2007-06-14 12:03
回复
得到正确答案了:
dw_1.setfilter("djrq>=date('"+em_1.text+"') and djrq<=date('"+em_2.text+"')")

[此贴子已经被作者于2007-6-14 12:36:24编辑过]

1