Menu

#56 Execute requires the command to have a transaction object

open
nobody
None
5
2005-02-22
2005-02-22
No

Dears,

I'm using AtomsFramework 2.0 and using explicity
transactions.
Then, some moments appear the error:

Execute requires the command to have a transaction
object when the connection assigned to the command is
in a pending local transaction. The Transaction property
of the command has not been initialized. Inner Exception
message

There is the complete error page:

Server Error in '/sigere' Application.
-------------------------------------------------------
-------------------------

Execute requires the command to have a transaction
object when the connection assigned to the command is
in a pending local transaction. The Transaction property
of the command has not been initialized. Inner Exception
message : Execute requires the command to have a
transaction object when the connection assigned to the
command is in a pending local transaction. The
Transaction property of the command has not been
initialized. Inner Exception message : Execute requires
the command to have a transaction object when the
connection assigned to the command is in a pending
local transaction. The Transaction property of the
command has not been initialized. Inner Exception
message : Execute requires the command to have a
transaction object when the connection assigned to the
command is in a pending local transaction. The
Transaction property of the command has not been
initialized.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and
where it originated in the code.

Exception Details: AToMSFramework.RetrieveException:
Execute requires the command to have a transaction
object when the connection assigned to the command is
in a pending local transaction. The Transaction property
of the command has not been initialized. Inner Exception
message : Execute requires the command to have a
transaction object when the connection assigned to the
command is in a pending local transaction. The
Transaction property of the command has not been
initialized. Inner Exception message : Execute requires
the command to have a transaction object when the
connection assigned to the command is in a pending
local transaction. The Transaction property of the
command has not been initialized. Inner Exception
message : Execute requires the command to have a
transaction object when the connection assigned to the
command is in a pending local transaction. The
Transaction property of the command has not been
initialized.

Source Error:

Line 1225: Catch ex As Exception
Line 1226:
clMap.RelationalDatabase.freeConnection(conn)
Line 1227: Throw New
RetrieveException(ex.Message, ex)
Line 1228: End Try
Line 1229:
clMap.RelationalDatabase.freeConnection(conn)

Source File:
C:\Sistemas\Sigere\Fontes\AtomsFramework\CPersistenc
eBroker.vb Line: 1227

Stack Trace:

[RetrieveException: Execute requires the command to
have a transaction object when the connection assigned
to the command is in a pending local transaction. The
Transaction property of the command has not been
initialized.
Inner Exception message : Execute requires the
command to have a transaction object when the
connection assigned to the command is in a pending
local transaction. The Transaction property of the
command has not been initialized.
Inner Exception message : Execute requires the
command to have a transaction object when the
connection assigned to the command is in a pending
local transaction. The Transaction property of the
command has not been initialized.
Inner Exception message : Execute requires the
command to have a transaction object when the
connection assigned to the command is in a pending
local transaction. The Transaction property of the
command has not been initialized.]

AToMSFramework.CPersistenceBroker.processRetrieveCrit
eria(CClassMap& clMap, CRetrieveCriteria& pCriteria,
Boolean fullObjects) in
C:\Sistemas\Sigere\Fontes\AtomsFramework\CPersistenc
eBroker.vb:1227

AToMSFramework.CPersistenceBroker.processRetrieveCrit
eria(CPersistentObject& obj, CRetrieveCriteria& pCriteria,
Boolean fullObjects) in
C:\Sistemas\Sigere\Fontes\AtomsFramework\CPersistenc
eBroker.vb:1212
AToMSFramework.CRetrieveCriteria.perform
(CPersistentObject obj) in
C:\Sistemas\Sigere\Fontes\AtomsFramework\CRetrieveCri
teria.vb:285
Negocio.Acesso.ObterPeloServidor(String
vstServidorMatCNEN, Collection vobOrdemCol, Collection
vobOrdemAscCol) in
C:\Sistemas\Sigere\Fontes\Negocio\Acesso.vb:434
Sigere.Global.Session_Start(Object sender, EventArgs
e) in C:\Sistemas\Sigere\Fontes\Site\Global.asax.vb:153

System.Web.SessionState.SessionStateModule.RaiseOnSt
art(EventArgs e) +132

System.Web.SessionState.SessionStateModule.Complete
AcquireState() +514

System.Web.SessionState.SessionStateModule.BeginAcq
uireState(Object source, EventArgs e, AsyncCallback cb,
Object extraData) +697

System.Web.AsyncEventExecutionStep.System.Web.Http
Application+IExecutionStep.Execute() +66
System.Web.HttpApplication.ExecuteStep
(IExecutionStep step, Boolean&
completedSynchronously) +173

-------------------------------------------------------
-------------------------
Version Information: Microsoft .NET Framework
Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

Discussion

  • Richard Banks

    Richard Banks - 2005-02-22

    Logged In: YES
    user_id=253192

    Inside CConnection.vb, find the object relevant to your
    database provider.

    Change the code in processSelectStatement from

    Try
    Dim m_adapter As New OleDbDataAdapter(m_command)
    If m_transactioncalls > 0 Then
    m_adapter.SelectCommand.Transaction = m_transaction

    --to--

    Try
    If m_transactioncalls > 0 Then m_command.Transaction =
    m_transaction
    Dim m_adapter As New OleDbDataAdapter(m_command)

    Let me know if that works OK. If it doesn't take out the
    check of "m_transactioncalls > 0" and try again.

     
  • Marcos Flavio de Oliveira

    Logged In: YES
    user_id=692605

    Dear Richard Banks,

    I'm testing it.
    Then, after some time i inform you.

    Thanks!

     
  • Richard Banks

    Richard Banks - 2005-03-14

    Logged In: YES
    user_id=253192

    any news on this one?

     
  • Marcos Flavio de Oliveira

    Logged In: YES
    user_id=692605

    Hi Richard!

    I tried the change:

    If m_transactioncalls > 0 Then m_command.Transaction =
    m_transaction
    Dim m_adapter As New OleDbDataAdapter(m_command)

    But, the error appears today again.

    Then I'm trying the second ideia:
    Let me know if that works OK. If it doesn't take out the
    check of "m_transactioncalls > 0" and try again.

    Later, I inform you.

    Thanks.

     
  • Nobody/Anonymous

    Logged In: NO

    Hi Richard!

    I tried the second ideia: check of "m_transactioncalls > 0".
    Then the transactions dont execute correct. Some updates
    was commited before the explicit commit. And when i used
    the rollback the updates didnt rollback.

    The problem persist for the moment.

    Thanks.

     
  • Richard Banks

    Richard Banks - 2005-04-01

    Logged In: YES
    user_id=253192

    Hi Marcos,

    Good news (I think). I managed to duplicate the problem :-)

    It happened during a delete operation that threw a rollback,
    and I then had a framework exception thrown (inside the
    rollback). Subsequent operations would then fail because
    the previous transaction wasn't closed properly.

    I've changed around the code in the providers to close the
    transaction before attempting the cache roll back and I've
    also put a bit more error checking in the cache roll back as
    well. Hopefully that fixes the problem you are having as
    well. Developers CVS is updated now.

    - Richard.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.