When running an application in PowerBuilder and connecting to MS SQL Server 2008 using ADO.NET, getting the following error:
System.InvalidOperationException: This SqlTransaction has completed; it is no longer usable.
at Sybase.PowerBuilder.Db.Block.SqlBlock.ProcessError(Exception ee)
at Sybase.PowerBuilder.Db.Data.DbBlock.DoTransaction(PbTrans oper)
at Sybase.PowerBuilder.Db.DbRoutine.DoTransaction(PbTrans oper)
- Microsoft SQL Server
In the PowerBuilder database trace log, for every Begin Transaction there should be a Commit statement. At some point in the log file, you no longer can pair the Begin Transaction and Commit statements.
In one of the ancestor windows, there were these statements:
ls_sql = "commit"
execute immediate ls_sql;
It caused an extra commit to be issued and that was causing the error.