DBError 1007 Committing changes on mssql

The stable tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.
Post Reply
aleroot
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 21.02.2013, 22:27

DBError 1007 Committing changes on mssql

Post 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 ?
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: DBError 1007 Committing changes on mssql

Post by EgonHugeist »

What about AutoCommit mode?

Which Connection settings do you use?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
aleroot
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 21.02.2013, 22:27

Re: DBError 1007 Committing changes on mssql

Post 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.
Post Reply