コード例 #1
0
        /// <summary>
        ///		Obtiene el número de registro de una consulta
        /// </summary>
        public async Task <long?> GetRecordsCountAsync(string sql, ParametersDbCollection parametersDB,
                                                       TimeSpan?timeOut = null, CancellationToken?cancellationToken = null)
        {
            if (SqlParser == null)
            {
                return(null);
            }
            else
            {
                object result = await ExecuteScalarAsync(SqlParser.GetSqlCount(sql), parametersDB, CommandType.Text, timeOut, cancellationToken);

                if (result == null)
                {
                    return(null);
                }
                else if (result is long)
                {
                    return((long?)result);
                }
                else
                {
                    return((int?)result);
                }
            }
        }
コード例 #2
0
        /// <summary>
        ///		Obtiene el número de registro de una consulta
        /// </summary>
        public long?GetRecordsCount(string sql, ParametersDbCollection parametersDB, TimeSpan?timeOut = null)
        {
            if (SqlParser == null)
            {
                return(null);
            }
            else
            {
                object result = ExecuteScalar(SqlParser.GetSqlCount(sql), parametersDB, CommandType.Text, timeOut);

                if (result == null)
                {
                    return(null);
                }
                else if (result is long)
                {
                    return((long?)result);
                }
                else
                {
                    return((int?)result);
                }
            }
        }