小弟在mssql中一主從表
主表中有一觸發器:
CREATE TRIGGER del_child_table ON [dbo].[Month_Check_C]
FOR DELETE
as
delete Month_Check_C1 from (select nos,id from deleted ) as a
where Month_Check_C1.sub_id=a.id 在後台刪除主表記錄OK在delphi前台用如下刪除出錯:tparent_qu.Delete;
tparent_qu.UpdateBatch();錯誤如下:
key information is insufficient or incorrent.too many rows were
affected by update
主表中有一觸發器:
CREATE TRIGGER del_child_table ON [dbo].[Month_Check_C]
FOR DELETE
as
delete Month_Check_C1 from (select nos,id from deleted ) as a
where Month_Check_C1.sub_id=a.id 在後台刪除主表記錄OK在delphi前台用如下刪除出錯:tparent_qu.Delete;
tparent_qu.UpdateBatch();錯誤如下:
key information is insufficient or incorrent.too many rows were
affected by update
解决方案 »
- DELPHI这种情况怎么办?
- 求助:TTable 控件如何实现 DBGrid的单击标题排序
- 怎样让树型的节点Tlable(treeview1.selected.data).caption)支持SQL语句?
- 一个和Label相关的小问题,在线等,答对送分^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!!
- delphi和C++高手进!delphi代码转C++代码!请高手指点。
- 初学Dephi:一个类的the_item属性表示什么?
- 为何SqlServer不能标示''?????
- 请问这句话错哪了?
- 自绘控件中有VCL成员(如TEdit),能不能把成员的属性公布出来?如何做?
- 我的防火墙老是提示别的ip地址访问我的Http[80] 端口
- DBChart的问题
- 为什么存储过程执行SQL时报错?
表的主键嗎,有
FOR DELETE
as
delete Month_Check_C1 where Month_Check_C1.sub_id=(select id from deleted)
FOR DELETE
as
delete Month_Check_C1 where sub_id=(select id from deleted)試試!>>>>> 你的代碼: (select nos,id from deleted ) as a 有錯!
在触发器中先SELECT 出主表关连从表的字段,在删除子表。