錯誤訊息:
Cannot create new connection because in manual or distributed transaction mode.
程式碼:
if not CN.InTransaction then CN.StartTransaction(ATD);
TQ := TSQLquery.Create(nil);
TQ.SQLConnection := CN;
TQ.SQL.Text := 'SELECT * FROM 資料表';
TQ.Open;
while not TQ.Eof do begin
TQ2 := TSQLquery.Create(nil);
TQ2.SQLConnection := CN;
TQ2.SQL.Text := 'SELECT Top 1 * FROM 資料表';
TQ2.Open; <-- Cannot create new connection because in manual or distributed transaction mode.
TQ2.Close;
Next;
end;
CN.Commit(ATD);


請先 登入 以發表留言。