那就麻烦了,用方法2把逐个取出来相加再放回dw_3
long i, ll_row, ll_ins
string ls_xh//型号
decimal ld_sl//数量
for i = 1 to dw_1.rowcount()
ls_xh = dw_1.getitemstring(i, 'xh')
ll_row = dw_2.find("xh='"+ls_xh+"'",1, dw_2.rowcount())
if ll_row > 0 then
ld_sl = dw_1.getitemdecimal(i, 'sl')+dw_2.getitemdecimal(i,'sl')
else
ld_sl = dw_1.getitemdecimal(i, 'sl')
end if
if ld_sl > 0 then
ll_ins = dw_3.insert(0)
dw_3.setitem(ll_ins, 'xh', ls_xh)
dw_3.setitem(ll_ins, 'sl', ld_sl)
end if
next
if dw_3.update() > 0 then
commit;
else
rollback;
end if
考虑一下吧!不知道管不管用,没试过的
ldec_num1=dw_1.object.数量
ldec_num2=dw_2.object.数量
int p=1
for i=1 to uperbound(ls_type1)
ls_type_tem=ls_type1[i]
for j=1 to uperbound(ls_type2)
if ls_type2 [j]=ls_type_tem then
ls_type3[p]=ls_type_tem
ldec_num3[p]=ldec_num1[i]+ldec_num2[j]
p=p+1
exit
else
continue
end if
next
next
//在数据窗3中插入响应的记录
if uperbound(ls_type3) >0 then
for q=1 to uperbound(ls_type3)
dw_3.object.data[q,1]=ls_type3[q] //型号
dw_3.object.data[q,2]=ldec_num3[q] //数量
next
end if
//如果数据窗仅供显示,可不必更新这样可不知是否符合你的需求?