以文本方式查看主题

-  蓝色快车PB俱乐部论坛  (http://pb.besoft.com.cnhttp://pb.besoft.com.cn/bbs/index.aspindex.asp)
--  PowerBuilder MIS编程  (http://pb.besoft.com.cnhttp://pb.besoft.com.cn/bbs/index.aspbbs.asp?boardid=1)
----  DataStore Update 问题,大虾们出手啊!!!  (http://pb.besoft.com.cnhttp://pb.besoft.com.cn/bbs/index.aspdispbbs.asp?boardid=1&rootid=1887&id=1908)


--  作者:Doctor11971
--  发布时间:2004/6/15 9:37:10

--  DataStore Update 问题,大虾们出手啊!!!
这样使用的:
if datastore.update()=1 then
datastore.resetupdate()
commit;
else
end if
现在*作一个存储,第一次保存的时候update正常,但是连着*作第二次的时候,总是提示datastore.update()=-1,update不成功。不知道是为什么会update()=-1,大虾们可否提示一二,感激不尽
--  作者:zhangyao2k
--  发布时间:2004/6/15 9:46:05

--  
你改成
if datastore.update(true,false)=1 then
试试??
--  作者:Doctor11971
--  发布时间:2004/6/15 10:51:43

--  
没好使,不过还是谢谢啦!
--  作者:cmaboy
--  发布时间:2004/6/15 18:59:17

--  
道理很简单,其实,对于数据窗口而言,她对数据的编辑后,进行数据保存,是靠里面的一堆状态标志来控制的,你第一保存数据后,应该利用resetupdate()把*作的标志清调,否则,第二次保存时,如果你存在insert,那么,就会出错,因为主键冲突了
--  作者:Doctor11971
--  发布时间:2004/6/16 12:04:18

--  
Ok,上面到是也用到了,不过是这样datastore.resetupdate()在commit之前了,是不是应该在后面,再试试,多谢指教.
--  作者:bluesea
--  发布时间:2004/6/16 15:57:20

--  
if datastore.update(true,false)=1 then
datastore.resetupdate()
commit;
else
rollback;
end if

试试看


[此贴子已经被bluesea于2004-6-16 15:57:20编辑过]

">