Ejemplo n.º 1
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Int16}"/>
        /// </summary>
        /// <param name="record">The data record</param>
        /// <param name="name">The name of the column</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Int16}"/> </returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Int16"/> if possible.
        /// </remarks>
        public static short?GetNullableInt16(this IDbDataRecord record, string name)
        {
            if (record.IsDBNull(name))
            {
                return(null);
            }

            return(record.GetInt16(name));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Int16}"/>.
        /// </summary>
        /// <param name="record">The data record.</param>
        /// <param name="index">The zero-based column ordinal.</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Int16}"/>.</returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Int16"/> if possible.
        /// </remarks>
        public static short?GetNullableInt16(this IDbDataRecord record, int index)
        {
            if (record.IsDBNull(index))
            {
                return(null);
            }

            return(record.GetInt16(index));
        }