Page 1 of 1

DBError 1007 Committing changes on mssql

Posted: 21.09.2013, 19:51
by aleroot
Hi,
I have a strange problem with ZEOS 7.0.5 and SqlServer 2005 using the mssql library, when I try to commit changes i get the error DBError 1007 from SQL Server that says that A Begin Transaction is not called ...

The strange thing is that the record is correctly inserted in the database table despite the error message.

The following code works for postgresql and mysql, but it fails with DBError 1007 on mssql :

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
    Conn.StartTransaction;
    try
    ZQuery1.SQL.Add('INSERT INTO supervisor_key VALUES (:COD, :VAL)');
    ZQuery1.ParamByName('COD').AsString := 'AleKey';
    ZQuery1.ParamByName('VAL').AsString := 'AleValue';

    ZQuery1.ExecSQL;
    Conn.Commit
    except
       Conn.Rollback
    end
end;
Why ?
Is it a bug or Am I doing something wrong ?

Re: DBError 1007 Committing changes on mssql

Posted: 25.09.2013, 19:25
by EgonHugeist
What about AutoCommit mode?

Which Connection settings do you use?

Re: DBError 1007 Committing changes on mssql

Posted: 27.09.2013, 10:45
by aleroot
AutoCommit = True
Protocol = 'mssql'

Others to default ... With other database type (e.g. : PostgreSQL, Mysql) it works without any problem, while on mssql I have the above error.