关于检索按扭的click事件该怎么写?解决问题者(重分酬谢)

flyhot 2002-10-24 07:55:22
1 对数据窗口进行单个检索(没条记录);
2 对数据窗口进行全部检索;
string s_jglx,s_bjbh,str,s_select
dw_1.settransobject(sqlca)
dw_1.retrieve()
s_select=dw_1.describe("DataWindow.Table.Select")

dw_1.settransobject(sqlca)
if ddlb_jglx.text="" and sle_1.text="" then
messagebox("提示","无记录")
return
end if
if ddlb_jglx.text<>"" and sle_1.text<>"" then

s_jglx=" jglx='"+ddlb_jglx.text+"'"
s_bjbh=" and (bjbh like '%"+sle_1.text+"%')"
str="DataWindow.Table.Select= ~" "+ s_select + "where"+s_jglx + s_bjbh + "~" "
end if

但是结果总是检索不到想要的数据!
请个位大侠看看!
...全文
63 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
flyhot 2002-10-24
  • 打赏
  • 举报
回复
能帖个列字出来吗?
你的代码我有点模糊!
多谢!
问题1,2是同样的原理吗 ?
flyhot 2002-10-24
  • 打赏
  • 举报
回复
问题解决了马上结贴!!!
sweetgirl 2002-10-24
  • 打赏
  • 举报
回复
关注
zhanwei 2002-10-24
  • 打赏
  • 举报
回复
CSDN还有这毛病啊,唉
zhanwei 2002-10-24
  • 打赏
  • 举报
回复
global type gf_add_where from function_object
end type

forward prototypes
global function integer gf_add_where (datawindow ad_dw, string as_where)
end prototypes

global function integer gf_add_where (datawindow ad_dw, string as_where);string ls_old,ls_new,ls_old1,ls_old2
int li_pos,li_pos2
if as_where = '' or isnull(as_where) then return 1
as_where='('+as_where+')'
ls_old=ad_dw.Describe("DataWindow.Table.SQLSelect")
li_pos=pos(lower(ls_old),' order by')
li_pos2=pos(lower(ls_old),' group by')
if li_pos2>0 then li_pos=min(li_pos,li_pos2)
if li_pos>0 then
ls_old1=left(ls_old,li_pos)
ls_old2=right(ls_old,len(ls_old) - li_pos+1)
else
ls_old1=ls_old
end if
li_pos=pos(lower(ls_old1),' where ')
if li_pos>0 then
ls_old1=left(ls_old1,li_pos -1)+' WHERE '+right(ls_old1,len(ls_old1) - li_pos -6)
ls_new=ls_old1+" and "+as_where+ls_old2
else
ls_new=ls_old1+" WHERE "+as_where+ls_old2
end if

if ad_dw.modify("datawindow.table.select = ~"" + ls_new + "~"") = '' then
return 1
else
ad_dw.modify("datawindow.table.select = ~"" + ls_old + "~"")
return -1
end if

end function

zhanwei 2002-10-24
  • 打赏
  • 举报
回复
global type gf_add_where from function_object
end type

forward prototypes
global function integer gf_add_where (datawindow ad_dw, string as_where)
end prototypes

global function integer gf_add_where (datawindow ad_dw, string as_where);string ls_old,ls_new,ls_old1,ls_old2
int li_pos,li_pos2
if as_where = '' or isnull(as_where) then return 1
as_where='('+as_where+')'
ls_old=ad_dw.Describe("DataWindow.Table.SQLSelect")
li_pos=pos(lower(ls_old),' order by')
li_pos2=pos(lower(ls_old),' group by')
if li_pos2>0 then li_pos=min(li_pos,li_pos2)
if li_pos>0 then
ls_old1=left(ls_old,li_pos)
ls_old2=right(ls_old,len(ls_old) - li_pos+1)
else
ls_old1=ls_old
end if
li_pos=pos(lower(ls_old1),' where ')
if li_pos>0 then
ls_old1=left(ls_old1,li_pos -1)+' WHERE '+right(ls_old1,len(ls_old1) - li_pos -6)
ls_new=ls_old1+" and "+as_where+ls_old2
else
ls_new=ls_old1+" WHERE "+as_where+ls_old2
end if

if ad_dw.modify("datawindow.table.select = ~"" + ls_new + "~"") = '' then
return 1
else
ad_dw.modify("datawindow.table.select = ~"" + ls_old + "~"")
return -1
end if

end function

flyhot 2002-10-24
  • 打赏
  • 举报
回复
dw_2.modify(str)
dw_2.retrieve()


是这样吗?
我试了不行呀?
能不能找点好的结构?
代码???
多谢了!
zhanwei 2002-10-24
  • 打赏
  • 举报
回复
MODIFY()啊

611

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder DataWindow
社区管理员
  • DataWindow社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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