I've been stuck on this for a few days now, and still can't figure out why :
I need to update a record in my Oracle database, before executing the Update query, I want to lock the data with a "SELECT x FOR UPDATE NOWAIT", but when calling the ExecuteNonQuery, my webservice hangs.
Executing the sql statement directly against the database works instantly. Here is the code :
OracleTransaction transact = OraDCS.BeginTransaction();
OracleCommand cmd = OraDCS.CreateCommand();
cmd.CommandText = string.Format("UPDATE FLIGHT_MANIFEST_PASSENGER SET ETAT_PASSAGER = '{2}',GATE_BOARDING = {0} WHERE REF_DOSSIER = '{1}'", ConfigurationManager.AppSettings["CodeMoyen"].ToString(), ref_dossier, etatPax);
OracleCommand blq = OraDCS.CreateCommand();
blq.CommandText = string.Format("SELECT * FROM FLIGHT_MANIFEST_PASSENGER WHERE REF_DOSSIER = '{0}' FOR UPDATE NOWAIT", ref_dossier);
bool blqOK = false;
try
{
blq.ExecuteNonQuery();
blqOK = true;
}
catch (Exception ex)
{
LogThreadSafe.Instance.Info("LanceSQL Error : " + blq.CommandText + " " + ex.Message);
}
if (blqOK)
{
try
{
cmd.ExecuteNonQuery();
transact.Commit();
}
catch (Exception ex)
{
transact.Rollback();
LogThreadSafe.Instance.Info("LanceSQL Error : " + blq.CommandText + " " + ex.Message);
}
}
else
transact.Rollback();
The lock is actually performed on the databse, but the program still hangs at this line :
blq.ExecuteNonQuery();
EDIT : Even after linking the transaction to the command I still experience the freeze. However, when I deploy my webservice on the server, and test it "live" rather than in debug on my dev machine, it works, any ideas?