Example #1
0
        public long ExecuteScalarLong(IDbCommand command)
        {
            if (AutoOpenClose)
            {
                Open();
            }

            command.Connection     = SqlConnection;
            command.CommandTimeout = CommandTimeout;
            long result = DatabaseConverter.ToLong(command.ExecuteScalar());

            if (AutoOpenClose)
            {
                Close();
            }

            return(result);
        }
Example #2
0
        public long ExecuteDataTableLong(IDbCommand command)
        {
            DataTable dataTable = ExecuteDataTable(command);

            return(!HasRows(dataTable) ? 0 : DatabaseConverter.ToLong(dataTable.Rows[0][0]));
        }