This IfxTransaction has completed; it is no longer usable

拥有回忆 提交于 2019-12-02 04:45:52

You seem to be handling errors and rolling back the transaction in two places (in Execute_NonQueryWithTransaction and in InsertGroups.

And the return from Execute_NonQueryWithTransaction is used both to return error codes and to return rows affected. But in InsertGroups it is checked purely as a rows affected.

Could you have an error code from Execute_NonQueryWithTransaction (so transaction rolled back) being treated as success (rows inserted) in InsertGroups and the commit then fails?

Overall the code needs significant cleanup:

  1. A catch block to only throw is pointless and just adds noise.
  2. Just use exceptions for error handling, all normal returns should indicate success.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!