回 帖 发 新 帖 刷新版面

主题:请教高手:setfilter如何引用变量?

已知:单位人员年龄表。
需求:输入一个数字,用数据窗口反馈所有年龄大于或小于此数字的人员名单。

string agefilter
agefilter = sle_1.text
dw_1.setfilter('age > agefilter')

dw_1.setfilter("age > '" + agefilter + "'")

试了多次,但始终不能成功,查了sybase book on line,说的莫名其妙:
The filter expression is a string and does not contain variables. However, you can build the string in your script using the values of script variables. Within the filter string, string constants must be enclosed in quotation marks (see the examples).

filter应该是个string,但无论怎么写,总是报错:“Types of expression must match!”

请教高手:是否不能引用变量呢?

回复列表 (共2个回复)

沙发


string agefilter
agefilter = "age="+"'"+sle_1.text+"'"
dw_1.setfilter(agefilter)

板凳

我感觉应该是这样:

string ls_condition,ls_con
ls_con=sle_1.text
ls_condition = "age>"+"'"+ls_con+"'"
dw_1.setfilter(ls_condition)
你可以试试

我来回复

您尚未登录,请登录后再回复。点此登录或注册