有这样一段代码,用的是数据存储
openwithparm(w_unit_list,s)
Datastore dw
dw= create Datastore
dw=message.PowerObjectParm
if isnull(dw)=false then
int irow,rows
rows=dw.rowcount()
for irow=1 to rows
if irow =1 then
this.object.company[row]=dw.object.company[1]
else
int ii
ii=this.insertrow(0)
this.object.company[ii]=dw.object.company[irow]
end if
next
end if
用控制菜单上的叉叉关闭窗口时,会报错:
error:null object reference at line 15 in buttonclicked event of object dw_3 of w_add_item.
15行是:rows=dw.rowcount()这一句
------解决方案--------------------
试试setTransObject(sqlca)
------解决方案--------------------
很可能是你窗口变量没有传递过来
另:用IsValid(dw)=True 来判断,不是Isnull()
------解决方案--------------------
试下:
Datastore dw
dw= create Datastore
dw=message.PowerObjectParm
-----------------------------改成
datawindow dw
if isvalid(message.PowerObjectParm) then
dw = message.PowerObjectParm
end if
dw.settransobject(sqlca)
dw.retrieve()
-----------------------
int irow,rows
rows=dw.rowcount().........
------解决方案--------------------
message.PowerObjectParm是datawindow还是datastore?如果是传datastore,那么:
-----------
Datastore dw
dw= create Datastore
if isvalid(message.PowerObjectParm) then
dw=message.PowerObjectParm
....
跟踪下,看是否传过来,从报错看,你传的对象不存在``