如何判断数据窗口在Update()时,是Insert还是Update?

dllwei 2003-04-18 11:25:02
如题。
...全文
251 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhouweiwansui 2003-04-18
  • 打赏
  • 举报
回复
so easy.....数据窗口更新的时候,sqlpriview事件中的参数sqlpriviewtype标志了更新的类型:
PreviewSelect! PreviewSelect 1 A SELECT statement
PreviewInsert! PreviewInsert 2 An INSERT statement
PreviewDelete! PreviewDelete 3 A DELETE statement
PreviewUpdate! PreviewUpdate 4 An UPDATE statement
居然没人知道?
flyhot 2003-04-18
  • 打赏
  • 举报
回复
update!
oliveinfo 2003-04-18
  • 打赏
  • 举报
回复
依照此方法,也可以判断删除缓冲区的状态,如果是新增加并且删除,那么不产生delete语句
如果是查询出来的,那么应该产生delete语句
这是我推断的,没有试验过,可以跟踪一次就知道数据窗口是怎样处理删除缓冲区的数据
oliveinfo 2003-04-18
  • 打赏
  • 举报
回复
如果行的状态的datamodified!,那么产生update语句
如果是newmodified!那么产生insert语句
如果是new!或者是notmodified!则不作处理

具体怎么活的行列状态可以使用getitemstates,用法可以参看pb的帮助

xuyi1979 2003-04-18
  • 打赏
  • 举报
回复
不懂你的意思,DW的UPDATE属性中不是有USE DELETE AND INSERT和USE UPDATE选项吗?
th820901 2003-04-18
  • 打赏
  • 举报
回复
学习
shahand 2003-04-18
  • 打赏
  • 举报
回复
string ls_update = <DW Control Name>.Object.DataWindow.Table.UpdateTable


?Yes ?Use the UPDATE statement when the key is changed so that the key is updated in place
?No ?Use a DELETE and an INSERT statement when the key is changedCaution When there are multiple rows in a DataWindow object and the user switches keys or rows, updating in place may fail due to DBMS duplicate restrictions.

Painter: Rows>Update Properties, Key Modification
byfq 2003-04-18
  • 打赏
  • 举报
回复
dwItemStatus l_status

l_status = dw_1.GetItemStatus( long row, integer column, DWBuffer dwbuffer )

For rows in the primary and filter buffers, Update generates an INSERT statement for rows with NewModified! status. It generates an UPDATE statement for rows with DataModified! status and references the columns that have been affected.
For rows in the delete buffer, Update does not generate a DELETE statement for rows whose status was New! or NewModified! before being moved to the delete buffer.
huangxinru 2003-04-18
  • 打赏
  • 举报
回复
dw.getitemstatus()
dllwei 2003-04-18
  • 打赏
  • 举报
回复
那么在数据窗口对象的Update Properties窗口中,左边的Where Clause for Update/Delete是什么意思,右边的Key Modification是什么意思?
yoyocd 2003-04-18
  • 打赏
  • 举报
回复
同意楼上的

1,075

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧