문제

Do you know the difference between these two conditions?

1

if(reader.hasrows())
{
   while(reader.read())
   {

   }
}

2

while(reader.read())
{
   if(reader.hasrows())
   {
   }
}
도움이 되었습니까?

해결책

Doing if/while or while/if is not necessary, since "while(reader.read())" will only return true when the reader has rows "hasrows()" and has a row to read "read()". The extra nesting has no value.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top