cancel
Showing results for 
Search instead for 
Did you mean: 

Transaction not actually commited

Former Member
0 Kudos

I start a trans. I'm adding some userfields in a usertable. no errors. thus, i do in the end:

if (this.company.InTransaction)

this.company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit);

i have no error. it's executing the endtransaction.

problem: i do not see anything at all modified in my db (like as all my add/updates to usertables are ignored).

any help?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

to whom it may concern: i've found after many hours the issue. problem was a trigger on insert in the user tables. it contained errors. but, unfortunately, DI is not smart enough to ensure the error propagation. so DI was reporting success, even the trigger was failing and thus the transaction failed.

Former Member
0 Kudos

Hi Cristian,

I've not come accross anything like this before - do you have a code sample that I could test on my system?

Regards,

Niall

Former Member
0 Kudos

here's code snippet that is essential (part of a function)

this.company.StartTransaction();

try

{

oUserTable = this.company.UserTables.Item("TABLE1");

oUserTable.Code = "DUMMY"; // will be replaced be real autoincrement ID by a trigger in DB

oUserTable.Name = "DUMMY"; // same as above

lErrCode = oUserTable.Add();

if (lErrCode != 0)

{

int transTemp0 = System.Convert.ToInt32(lErrCode);

controller.ConectionInstance.Company.GetLastError(out transTemp0, out sErrMsg);

if (this.company.InTransaction)

this.company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack);

return false;

}

oUserTable = this.company.UserTables.Item("TABLE2");

if (oUserTable == null)

return false;

oUserTable.Code = "DUMMY";

oUserTable.Name = "DUMMY";

lErrCode = oUserTable.Add();

if (lErrCode != 0)

{

int transTemp0 = System.Convert.ToInt32(lErrCode);

controller.ConectionInstance.Company.GetLastError(out transTemp0, out sErrMsg);

if (this.company.InTransaction)

this.company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack);

return false;

}

// commit

if (this.company.InTransaction)

this.company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit);

}

catch (Exception ex)

{

// rollback

if (this.company.InTransaction)

this.company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack);

return false;

}

finally

{

oUserTable = null;

}

return true;

Former Member
0 Kudos

Cristian,

the hint of transaction is, that when some action with sbo object falls, your transaction is rollbacked and you arent in transaction after this (auto roll back).

Former Member
0 Kudos

yes Petr. i know. but i debbuged the code line by line and i did not have any exception, nor any error caught by getlasterror.. no error reported. that is why I'm stupefied

former_member191896
Active Participant
0 Kudos

Hi Cristian,

Meta data operations (like creating tables, fields etc.) are not supported in the context of a Transaction (other than when your DB is MS SQL 2000)

Refer the description of StartTransaction method in SDK Help.

Using a meta data object in a transaction is available only while working with MSSQL 2000 bdatabase. For DB2, Sybase, and MSSQL 2005 databases this meta data objects are not applicable due to database limitations.

HTH

Aravind