Hello,
I'd like to use transactions accessing
MSSQL 2005. I'm using Delphi 5.
The following code causes
Ole exception:
Delphi-Quellcode:
_conId := TADOConnection.Create (nil);
_conId.ConnectionString := ConnString;
_conId.IsolationLevel := ilSerializable;
_conId.LoginPrompt := False;
_conId.CursorLocation := clUseClient;
_conId.Mode := cmShareExclusive ;
_conId.Open('mirek2', 'mirek2');
_qrySelectCircle := TADOQuery.Create(nil);
_qrySelectCircle.SQL.Text := 'SELECT VALUE FROM TAB WHERE NAME = :Name';
with _qrySelectCircle.Parameters.AddParameter do
begin
Name := 'Name';
DataType := ftString;
Direction := pdInput;
end;
_qrySelectCircle.Prepared := True;
_qrySelectCircle.Connection := _conId;
_conId.BeginTrans();
_qrySelectCircle.Parameters.ParamByName('Name').Value := circle;
_qrySelectCircle.CursorType := ctKeyset ;
_qrySelectCircle.LockType := ltOptimistic;
_qrySelectCircle.RecordSet := nil;
_qrySelectCircle.Open();
At this point an
exception occurs:
In German:
"Mehrfache Recordsets sind bei einer Transaktion mit diesem Cursortyp nich
t moeglich. Aendern Sie entweder den Cursortyp, fuehren Sie Commit fuer die Transakt
ion aus, oder schliessen Sie eines der Recordsets"
which translates into english
"multiple recordsets are not possible for a transaction with this cursor type. Change either the cursor type or execute commit or close one record set"
What am I doing wrong and how can I fix it. I really need the transactios.
Thanks in advance