Executes a non-query command and returns the affected records