示例#1
0
        public virtual async Task <object> ExecuteScalarAsync(CommandType cmdType, string cmdText,
                                                              params OracleParameter[] commandParameters)
        {
            using (var connection = new OracleConnection(ConnectionString))
            {
                using (var command = new OracleCommand(cmdText, connection))
                {
                    try
                    {
                        command.CommandType = cmdType;

                        command.Parameters.AddRange(commandParameters);

                        connection.Open();
                        return(await command.ExecuteScalarAsync());
                    }
                    finally
                    {
                        connection.Close();
                    }
                }
            }
        }