Home > database >  Ask a question of Transaction object
Ask a question of Transaction object

Time:10-02

Masters, consult a Transaction object problem:
I need to use two database connections, one is the SQLCA, another is his own statement of a Transaction, a thorny problems now, is that the Transaction even if the AutoCommit=False and no way to Rollback, the Rollback returns an error message, and each performs a SQL automatically Commit.
Is there a way to solve this problem?

CodePudding user response:

The
refer to the original poster lqin_rj posts:
masters, consult a Transaction object problem:
I need to use two database connections, one is the SQLCA, another is his own statement of a Transaction, a thorny problems now, is that the Transaction even if the AutoCommit=False and no way to Rollback, the Rollback returns an error message, and each performs a SQL automatically Commit.
Is there a way to solve this problem?


How did that happen?
Return an error? What is wrong

CodePudding user response:

The AutoCommit=False is written in the Transaction definitions?
Or is written before committing an AutoCommit=False, after submit again is set to true,

CodePudding user response:

There might be something wrong with your statement.
To be like this: the Transaction rollback their statement, write a rollback can't light or rollback the sqlca

CodePudding user response:

The rollback. By default the rollback sqlca;

You should specify transaction object
The rollback mytrans;

CodePudding user response:

The rollback defaults to rollback the sqlca; Should be accordingly specify transaction object,

CodePudding user response:

Thank you reply.

I have found the problem.

Because I create a Transaction object uo_db, wrote db_connect function in the object, function when connecting to the database Using the statement is to Connect Using This; .

Then the db_connect function content extracted directly performed alone, can't find no Rollback phenomenon. Then try to change This to uo_db, problem solved.

But I still don't understand the Connect Using This and Connect Using uo_db exactly have what differentiation? Also please exclude.

//function is as follows:
Db_connect (db_servername db_name, db_logid db_logpass)

Enclosing the DBMS="MSS Microsoft SQL Server"
Enclosing ServerName=db_servername
Enclosing the Database=db_name
Enclosing LogId=db_logid
Enclosing LogPass=db_logpass
Enclosing the AutoCommit=False

If This. DBHandle () & gt; 0 Then
Disconnect the Using This;
End the if

Connect Using the This ;

Return True

CodePudding user response:

This refers to the sqlca by default
  • Related