C# - Oracle Transaction Exception - Lot of users at same time - "Execute requires the Command object to have a Transaction..." -
i've developed web application. methods utilize transactions. works fine, except when several users start using webapplication @ same time. next message:
"execute requires command object have transaction object when connection object assigned command in pending local transaction. transaction property of command has not been initialized."
this situation @ moment:
1) there webapplication lot of different methods access oracle database. these methods not interact each other, each method performs own tasks.
2) methods utilize transaction, execute single sql statement , hence not utilize transaction.
when 1 user uses application, works fine. there no error in code or transactions not work.
when other users start using application @ same time, error mentioned before occurs. error can occur in methods not have methods utilize transactions.
we utilize oracle 10g database.
sample of code:
public string ns_info_estudo_tecnico_mod(stringdictionary strdict) {
openconn(); oracletransaction otrans = connection.begintransaction(isolationlevel.readcommitted); oraclecommand command = connection.createcommand(); command.transaction = otrans; command.commandtext = "gomnet_projetos.ns_info_estudo_tecnico_mod"; command.commandtype = commandtype.storedprocedure; seek { oracleparameter param30 = new oracleparameter("ncodigoerror",oracletype.number); param30.size = 1000; param30.direction = parameterdirection.output; command.parameters.add(param30); command.executenonquery(); if (param30.value.tostring() != "0") { otrans.rollback(); homecoming obtemmensagem(param30.value.tostring()); } else { otrans.commit(); } homecoming "0"; } grab (exception e) { throw e; } { command.dispose(); }
}
this application has much db access without close connection. utilize command.dispose() in lot of methods.
c# oracle transactions
No comments:
Post a Comment