I've got two classes(two components in one DLL): clsA a clsB. Both clsA and clsB "Require transaction". The class clsA has got the only one public function which executes SQL command, passed to this function as String parameter. Another parameter passes an opened DB connection object. Before the "Exit Function" statement is called EnableCommit() function, in the error treatment is called SetAbort() function and Err.Raise xxx. Being called for one SQL command, class clsA acts well. A SQL command is executed and an error causes "rollback transaction".
The class clsB was designed for executing of SQL batches, however always in ONE trasaction. The clsB has got the only one public function too. The SQL batch is passed to this function as String array. This function creates an object of clsA(!) type and creates and opens a DB connection object. The above descibed function is called inside a loop. This loop passes the connection object and the individual elements of the string array one by one into called function. Before the "Exit Function" statement is called SetComplete() function, in the error treatment is called SetAbort() function and Err.Raise xxx.
And that DOESN'T WORK!!! Whatever error inside SQL batch ends the loop but SQL commands executed before ARE NOT roll-backed! What' s wrong?
Thanks a lot!
(Win 2k + SQL Server 2000)
The class clsB was designed for executing of SQL batches, however always in ONE trasaction. The clsB has got the only one public function too. The SQL batch is passed to this function as String array. This function creates an object of clsA(!) type and creates and opens a DB connection object. The above descibed function is called inside a loop. This loop passes the connection object and the individual elements of the string array one by one into called function. Before the "Exit Function" statement is called SetComplete() function, in the error treatment is called SetAbort() function and Err.Raise xxx.
And that DOESN'T WORK!!! Whatever error inside SQL batch ends the loop but SQL commands executed before ARE NOT roll-backed! What' s wrong?
Thanks a lot!
(Win 2k + SQL Server 2000)