数据搜索的问题,很简单,但就是不知道问题出现再那里,程序已出各位帮帮忙吧,在线等候,

119119 2003-01-08 02:42:26
我现在已经创建了一个数据窗口,用直接选择的方式来进行选择。ddlb_1,ddlb_2。他们下面各有几个item。现在我用来搜索,语句如下:

string conditions
string lookfortext1,lookfortext2,operator
string lookforwhat1,lookforwhat2
operator="and"
lookfortext1=ddlb_1.text
lookfortext2=ddlb_2.text

conditions=""

if lookfortext1<>"" then
lookfortext1="cat"
lookforwhat1="ddlb_1.item"
end if
if lookfortext2<>"" then
lookfortext2="country"
lookforwhat2="ddlb_2.item"
end if

if lookfortext1<>"" then
conditions=lookfortext1+lookforwhat1
elseif lookfortext2<>"" then
conditions=conditions+operator+lookforwhat2+lookfortext2
end if

dw_1.setfilter(conditions)
filter(dw_1)
dw_1.retrieve()


if dw_1.rowcount()=0 then
messagebox("提示","查无此记录,重试!")
end if
在运行的时候,系统就提示出错信息expression is not valid!
搜索出来的信息根本就不是那回事!
帮我吧!朋友!高手,高高手!
...全文
49 16 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
119119 2003-01-08
  • 打赏
  • 举报
回复
对了,我并没有用游标的方式说明。
如果还有可以的话,还可以向我介绍如何将这个用直接选择方式来进行选择的方法的编码。
当然我会感激不尽!
119119 2003-01-08
  • 打赏
  • 举报
回复
对,我也发现了这个地方,但是我这么改呢。我试了好多方法。给点建议如何。楼上的
bomber2001 2003-01-08
  • 打赏
  • 举报
回复
lookfortext1="cat"
lookforwhat1="ddlb_1.text"
conditions=lookfortext1+lookforwhat1
似乎没有匹配表达式吧!
119119 2003-01-08
  • 打赏
  • 举报
回复
我改了以后还不是一样。我改了几个地方,他都有比如:纺织cat!,服装cat!
等向这样的警告!
groupliu 2003-01-08
  • 打赏
  • 举报
回复
兄弟你在OPEN世间里面先把ddlb_1.text和ddlb_2.text设置为空“”试一试
119119 2003-01-08
  • 打赏
  • 举报
回复
他说catddlb_1.text!提示这种警告是什么意思。
说明。我的cat是表示我的类别数据列
country表示我的国家数据列
huangxinru 2003-01-08
  • 打赏
  • 举报
回复
你在setfilter之前,用messagebox()看一下conditions写的是否正确
huangxinru 2003-01-08
  • 打赏
  • 举报
回复
kkbgp(kkb)说的对,你怎么在dw.filter()后,又加了一个retrieve()?
119119 2003-01-08
  • 打赏
  • 举报
回复
因为我想安慰一下我受伤的心,我看见总是说语句无效,所以我就加了这句
119119 2003-01-08
  • 打赏
  • 举报
回复
还是不对呀?????
为什么?就是不对呢,急死我也
kkbgp 2003-01-08
  • 打赏
  • 举报
回复
同意 huangxinru(键盘手) 说的
另外我想问一下,程序后半段中怎么过滤之后又retrieve呢
dw_1.setfilter(conditions)
filter(dw_1)
dw_1.retrieve()

huangxinru 2003-01-08
  • 打赏
  • 举报
回复
你的operator='and'应改成operator=' and '
119119 2003-01-08
  • 打赏
  • 举报
回复
还是不对呀。语法没有错,但是一运行就表示语句表达示有问题
zhangjun 2003-01-08
  • 打赏
  • 举报
回复
string conditions
string lookfortext1,lookfortext2,operator
string lookforwhat1,lookforwhat2
operator="and"
lookfortext1=trim(ddlb_1.text)
lookfortext2=trim(ddlb_2.text)

conditions=""

if lookfortext1<>"" or not isnull(lookfortext1) then
lookfortext1="cat"
lookforwhat1="ddlb_1.text"
end if
if lookfortext2<>"" or not isnull(lookfortext2) then
lookfortext2="country"
lookforwhat2="ddlb_2.text"
end if

if lookfortext1<>"" or not isnull(lookfortext1) then
conditions=lookfortext1+lookforwhat1
elseif lookfortext2<>"" or not isnull(lookfortext2) then
conditions=conditions+operator+lookforwhat2+lookfortext2
end if

dw_1.setfilter(conditions)
filter(dw_1)
dw_1.retrieve()


if dw_1.rowcount()=0 then
messagebox("提示","查无此记录,重试!")
end if
用messagebox("",conditions)看看表达式是否正确
119119 2003-01-08
  • 打赏
  • 举报
回复
还是不对
huangxinru 2003-01-08
  • 打赏
  • 举报
回复
ddlb_2.item 似乎应该是 ddlb_2.text

1,108

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧