Do you know the difference between these two conditions?
1
if(rea开发者_如何学Goder.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.
精彩评论