哪位大神帮满看上这个ll_count如何赋值

在线等 哪位大神帮满看下这个ll_count怎么赋值
string ls_wzbh,ls_wzmc,ls_wzfl1,ls_wzfl2

long ll_count,ll_row

dec ld_kcsl,ld_kcsl_temp,ld_sjyssl,ld_jhjg

ll_row=dw_1.getrow()

if ll_row <= 0 then 

    messagebox("提示","请选择要入库的单据")

    return

end if

if dw_1.object.ys[ll_row]='是' then

    messagebox("提示","本单已做入库不能重复处理")

    return

end if

ls_wzbh=dw_1.object.wzbh[ll_row]

ls_wzmc=dw_1.object.wzmc[ll_row]

ls_wzfl1=dw_1.object.wzfl1[ll_row]

ls_wzfl2=dw_1.object.wzfl2[ll_row]

ld_jhjg=dw_1.object.jhjg[ll_row]

ld_sjyssl=dw_1.object.sssl[ll_row]

应该是在这里吧 应该是 写这个软件的人 故意留的BUG 只能增加库存数量是0的货 有数量的货增加不了 最后 发现这段话 貌似少个 赋值 求大神解答

if ll_count > 0 then

    select isnull(kcsl,0) into :ld_kcsl

    from c_kcb

    where isnull(wzbh,"") = :ls_wzbh;

    ld_kcsl_temp=ld_kcsl+ld_sjyssl

    update c_kcb set kcsl=:ld_kcsl_temp

    where isnull(c_kcb.wzbh,'') = :ls_wzbh;

else

    ld_kcsl=0

    ld_kcsl_temp= ld_sjyssl

    insert into c_kcb

    (wzbh,wzmc,wzfl1,wzfl2,jhjg,kcsl)

    values (:ls_wzbh,:ls_wzmc,:ls_wzfl1,:ls_wzfl2,:ld_jhjg,:ld_kcsl_temp);

end if

dw_1.object.ys[ll_row]='是'

if dw_1.update()> 0 then

    commit;

else

    rollback;

end if
------解决方案--------------------
 select count(*) into :ll_count    from c_kcb
    where isnull(wzbh,"") = :ls_wzbh;

看你的代码 ll_count应该是检查有无该代码的记录,有则update,无则insert