做了一个窗口 里面包含添加数据控件和保存控件,其中保存控件的clicked代码如下:
integer number, g_rownumber,putin_number
string product_no,save_code
if dw_1.Update() = 1 then
commit;
save_code=dw_1.GetItemString(dw_1.getrow(),"lbbh")
product_no=dw_1.GetItemString(dw_1.getrow(),"xhbh")
SELECT max(stock.kcsl) INTO :number FROM stock
WHERE (stock.xhbh=:product_no) and (stock.lbbh=:save_code)
using sqlca;
putin_number= integer(dw_1.GetItemString(dw_1.getrow(),"rksl"))
number = number + putin_number
UPDATE stock SET kcsl =:number
WHERE stock.xhbh=:product_no;
commit;
else
//不能修改,则取消
rollback;
//警告
messagebox("警告","入库操作失败")
end if
点保存时,提示:datawindow column type does not match getitem type at line 17 in clicked event of object cb_3 of w_in 错误
bebug后知道是:putin_number= integer(dw_1.GetItemString(dw_1.getrow(),"rksl"))
出错,但是不知道怎么改才正确~~~~“rksl” 字段是numeric类型~~~刚学PB。。头痛呀~~
------解决方案--------------------
numeric类型的字段可以用GetItemDecimal
------解决方案--------------------
putin_number= integer(dw_1.object.rksl[dw_1.getrow()])