Example #1
0
        /// <summary>
        /// Executes a sql query and returns the value of first column of the first row.
        /// </summary>
        /// <typeparam name="T">Type of return value.</typeparam>
        /// <param name="query">Query sql to execute on database.</param>
        /// <param name="queryParams">Object or array that contains parameters to bind in query.</param>
        /// <returns>The value of first column of the first row of the type specified on T.</returns>
        public T GetValue <T>(string query, params object[] queryParams)
        {
            var result = GetValue(query, queryParams);

            return(DataReader.CastTo <T>(result));
        }