我用TClientDataSet.ApplyUpdates(0)更新數據時。
根據我觀察,好象dbexprees為每一個要更新的紀錄都新建一個連接。
這是我的代碼:
 clientdataset1.open;
  if not SQLConnection1.InTransaction then
  begin
    TD.TransactionID := 1;
    TD.IsolationLevel := xilREADCOMMITTED;
    SQLConnection1.StartTransaction(TD);
    clientdataset1.ApplyUpdates(0);
    SQLConnection1.Rollback(TD); 
  end;
這是mysql相應的log.
030506 15:17:04      39 Connect     root@xm on mcc
     39 Query       select * from autokey
030506 15:17:14      39 Query       SET AUTOCOMMIT=0
     39 Query       BEGIN WORK
     40 Connect     root@xm on mcc
030506 15:17:15      40 Query       update autokey  set
 cono = 'w'
where
 keyno = '13' and
 _type = 'R' and
 cono = 'o'
     40 Quit       
     41 Connect     root@xm on mcc
     41 Query       update autokey  set
 cono = 'w'
where
 keyno = '12' and
 _type = 'C' and
 cono = 'r'
     39 Query       ROLLBACK
     39 Query       SET AUTOCOMMIT=1
     39 Quit       
     41 Quit       
請問各位大俠如何解決?多謝。