datawindowchilde dwc_1
integer li_return
long ll_rowcount
string ls_filter
if dwo.name = 'b' then
li_return = dw_1.getchild("b" , dwc_1) //得到子datawindow
if li_return <> 1 then
messagebox("提示", "无法得到子datawindow!")
return
end if
ls_filter = " ( cdisplay like '%" + trim(data) + "%' ) or ( cdata like '%" + trim(data) + "%')"
dwc_1.settransobject(sqlca)
dwc_1.retrieve()
dwc_1.setfilter(ls_filter)
dwc_1.filter()
ll_rowcount = dwc_1.rowcount() //得到检索的行
if ll_rowcount > 0 then
dwc_1.ScrollToRow(ll_rowcount) //跳到满足条件的行的最后一行
else
insert t_child (cdata , cdisplay) values ('主键值' , :data) ;
if sqlca.sqlcode = 0 then
commit ;
messagebox("提示”,“保存成功!”)
else
rollback ;
messagebox("提示”,“保存失败!”)
end if
end if
end if