ado又一bug(30分)

W

wen_one

Unregistered / Unconfirmed
GUEST, unregistred user!
本人用ado連接sql2000的數據庫,其中主表為main(關鍵字:id,identity)主表detail
(關鍵字為:id,identity,並有一字段join_id與main表的id連接)。現本人寫main表的del
觸發器代碼如下delete detail from detial,deleted where detail.join_id=deleted.id
在sql執行delete main where id=123沒問題能刪除子表相連記錄
但在delphi下,
adoquery_main.delete;
adoconnection.begintrans
try
adoquery_main.updatebatch(arll);//這時出錯
adoconnection.committrans;
except
adoconnection.rollbackcommit;
end;
出錯信息為:key column information is insuffcient or incorrect,too many rows were
affected by update.
delphi為delphi6,ado為2.6的版本.

 
未必是bug,请检查:
1.updatebatch(arall) ,不是arll;
2.表main 和detail 的CursorType 是不是ctKeySet (the default) or ctStatic.
3.表main 和detail 的LockType 是不是 ltBatchOptimistic.

还不行的话,将adoquery_main.delete;放在事务处理的第一行试试.
再不行! 我倒@#!$

 
以上的我都檢查過了,沒問題。
但還是出錯。
 
老兄,你的問題是ADO的BUG,我前一段時間吃盡了苦頭,
將触發器的功能移到前台去寫吧.

用ADO,再用触發器作刪除,肯定錯.
記得加分喲!有心得就告訴我一下.
 
使用不当
 
如果移到前台我一早就想到了,不過還是給你分,算交一個朋友吧.wen_one@163.com

 
分數不多,請別見怪
 
顶部