Added affectedrows check