当前位置: 代码迷 >> PB >> Application terminated 异常!
  详细解决方案

Application terminated 异常!

热度:238   发布时间:2016-04-29 09:21:55.0
Application terminated 错误!!!
Error:Cannot convert long in Any variable to string at line 16 in open event of object w_Chengyungshang_new


string ls_chengyunshangbh,ls_max
long ll_row
int i
long ll_rowcount

dw_1.settransobject(sqlca)
w_chengyunshang.dw_main.sharedata(dw_1)

ls_max = ''

ll_rowcount = dw_1.retrieve()

if ll_rowcount = 0 then
ls_chengyunshangbh = "001"
else
ls_max = dw_1.object.chengyun_id[ll_rowcount]//这行的chengyun_id 出错
ls_chengyunshangbh = string(long(ls_max) + 1)
ls_chengyunshangbh = f_bmbq(3,ls_chengyunshangbh)

end if

ll_row = dw_1.insertrow(0)
dw_1.scrolltorow(ll_row)
dw_1.setitem(ll_row,"chengyun_id",ls_chengyunshangbh)

dw_1.setcolumn("chengyun_id")
dw_1.selecttext(1,99)

我数据库的bm_chengyun 表
chengyun_id char(3) not null
chengyun_name char(20) not null

都是字符串格式 怎么会出错呢


------解决方案--------------------
把dw_1的数据窗口对象edit source,
看看chengyun_id这个字段是char还是decimal
就知道问题所在了
------解决方案--------------------
ls_max = dw_1.object.chengyun_id[ll_rowcount]//这行的chengyun_id 出错

ls_max = dw_1.getitemstring(ll_rowcount,"chengyun_id")
------解决方案--------------------
chengyun_id 这个字段应该不是 string 类型的
------解决方案--------------------
加个强制类型转换
ls_max = string(dw_1.object.chengyun_id[ll_rowcount])
  相关解决方案