modify exit from loop

modify exit from loop. add function IsSameTableData.