OracleCommand TimeOut not working in C# code

481 Views Asked by At
public int ExecuteNonQuery(IDbTransaction dbTransaction, string commandText, CommandType commandType, IDbDataParameter[] parameters)
        {
            int returnValue = 0;

            try
            {
               var command = database.CreateCommand(commandText, commandType, dbTransaction.Connection);
              
                if (parameters != null)
                    {
                        foreach (var parameter in parameters)
                        {
                            //check for derived output value with no value assigned
                            if ((parameter.Direction == ParameterDirection.InputOutput) && (parameter.Value == null))
                            {
                                parameter.Value = DBNull.Value;
                            }
                            command.Parameters.Add(parameter);
                        }
                    }
                command.CommandTimeout = 600;
                returnValue = command.ExecuteNonQuery();
                
            }
            catch (Exception ex)
            {
                throw ex;
            }


            return returnValue;
        }

I am trying to execute db executing using above code through c# window service through Oracle.ManagedDataAccess library. Database is Oracle 11g. Problem here is that Command Timeout is not working even when query is taking more than 15 mins to execute. Please guide how to make it work?

0

There are 0 best solutions below