该怎么删除呢? 大家看看

chanwenbiao 2001-07-19 04:34:38
我的删除通过,三个关键字来确定的,(serialno,groupname,ocupationcode),,
我已将这三个关键字作成了,结构体,st_invitemeet,
我的删除代码:

下面只是由一个关键字来确定的(绝对正确),但我想由上面三个关键字来确定该怎么改呢?
long l_row
String LName
l_row=dw_1.getrow()
dw_1.setfocus()
LName = dw_1.GetItemString(l_row,"serialno")
if l_row > 0 then
delete from invitemeetdetail
where serialno=:LName;
if SQLCA.sqlcode <> 0 then
messagebox("invitemeetdetail","没成功2")
return
end if
delete from invitemeeting
where serialno=:LName;
if SQLCA.sqlcode <> 0 then
messagebox("invitemeeting","没成功")
return
end if
if SQLCA.sqlcode = 0 then
dw_1.deleterow(l_row)
messageBox( "Delete",&
"删除成功!")
commit;
cb_retrieve.Trigger Event clicked()//驱动刷新事件
else
rollback;
messageBox("Error","删除失败")

end if

end if

哪位人兄帮我搞定我会给你加分的!

...全文
172 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
chanwenbiao 2001-07-19
  • 打赏
  • 举报
回复
我把lzzyi(了中) 的代码改为:
st_invitemeet lst_invitemeet
long l_row
String Ls_serialno,ls_groupname,ls_ocupationcode

ls_serialno = lst_invitemeet.serialno
ls_groupname = lst_invitemeet.groupname
ls_ocupationcode = lst_invitemeet.ocupationcode
l_row = dw_1.getrow()
if l_row > 0 then
delete from invitemeetdetail
where serialno=:ls_serialno and groupname = :ls_groupname and ocupationcode = ls_ocupationcode;
if SQLCA.sqlcode = -1 then
messagebox("invitemeetdetail","没成功2")
rollback;
end if
delete from invitemeeting
where serialno=:ls_serialno and groupname = :ls_groupname and ocupationcode = ls_ocupationcode
if SQLCA.sqlcode = -1 then
messagebox("invitemeeting","没成功")
rollback;
end if
if SQLCA.sqlcode = 0 then
dw_1.deleterow(l_row)
commit;
messageBox( "Delete","删除成功!")
cb_retrieve.Trigger Event clicked()//驱动刷新事件
else
rollback;
messageBox("Error","删除失败")

end if
chanwenbiao 2001-07-19
  • 打赏
  • 举报
回复
我用了, lzzyi(了中) 的方法只运行到:messagebox("invitemeetdetail","没成功2")

chanwenbiao 2001-07-19
  • 打赏
  • 举报
回复
我用你们的方法没成功呀,
wangsw 2001-07-19
  • 打赏
  • 举报
回复
where serialno=:ls_name and groupname=:ls_group and ocupationcode=:ls_code
////


你的明白??
dotnba 2001-07-19
  • 打赏
  • 举报
回复
上面不可以吗?
chanwenbiao 2001-07-19
  • 打赏
  • 举报
回复
所以我就想用三个关键字来,约束呀,
只有serialno=:LName and groupname=:LName and ocupationcode=:LName
才删除,这样不就只删除一条了
dotnba 2001-07-19
  • 打赏
  • 举报
回复
st_invitemeet lst_invitemeet

delete from invitemeetdetail
where serialno=:lst_invitemeet.serialno and groupname = :lst_invitemeet.groupname and ocupationcode = :lst_invitemeet.ocupationcode
dotnba 2001-07-19
  • 打赏
  • 举报
回复
delete from invitemeetdetail
where serialno=:st_invitemeet.serialno and groupname = :st_invitemeet.groupname and ocupationcode = st_invitemeet.ocupationcode
lzzyi 2001-07-19
  • 打赏
  • 举报
回复
st_invitemeet lst_invitemeet
long l_row
String Ls_serialno,ls_groupname,ls_ocupationcode

ls_serialno = lst_invitemeet.serialno
ls_grouopname = lst_invitemeet.groupname
ls_ocupationcode = lst_invitemeet.ocupationcode
l_row = dw_1.getrow()
if l_row > 0 then
delete from invitemeetdetail
where serialno=:ls_serialno and groupname = :ls_groupname and ocupationcode = ls_ocupationcode;
if SQLCA.sqlcode = -1 then
messagebox("invitemeetdetail","没成功2")
rollback;
else
delete from invitemeetingwhere
where serialno=:ls_serialno and groupname = :ls_groupname and ocupationcode = ls_ocupationcode
if SQLCA.sqlcode = -1 then
messagebox("invitemeeting","没成功")
rollback;
else
commit;
messageBox( "Delete","删除成功!")
cb_retrieve.Trigger Event click()//驱动刷新事件
end if
end if
end if

nthb2001 2001-07-19
  • 打赏
  • 举报
回复
当然不对啊~~~
delete from invitemeetdetail
where serialno=:LName;
if SQLCA.sqlcode <> 0 then
messagebox("invitemeetdetail","没成功2")
return
end if
这个已经把相应的记录删除了啊。。。
也就是已经删除了多条记录啊
你要三个一起用啊~~~~

chanwenbiao 2001-07-19
  • 打赏
  • 举报
回复
up
chanwenbiao 2001-07-19
  • 打赏
  • 举报
回复
因为,一个serialno 对应几条记录,所以一删除就会删除多条呀,
所以要三个关键字来确定呀,
dotnba 2001-07-19
  • 打赏
  • 举报
回复
既然一个字段能确定,为什么还要用三个?
chanwenbiao 2001-07-19
  • 打赏
  • 举报
回复
up
chanwenbiao 2001-07-19
  • 打赏
  • 举报
回复
up
chanwenbiao 2001-07-19
  • 打赏
  • 举报
回复
up
help me
help me
help me

1,077

社区成员

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

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