How to check if result of request to DB is empty?
drug via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Dec 12 02:36:12 PST 2015
12.12.2015 13:28, Suliman пишет:
> it's seems that next block is execute even if is rs.next() is false:
>
> writeln("rs.next()-->", rs.next());
> if(!rs.next()) //if user do not in DB
> {
> // is execute even if rs.next() is false
> writeln("Executed, but rs.nst was set to false");
> }
>
> The output:
>> rs.next()-->false
>> Executed, but rs.nst was set to false
>
> Why?
>
>
That's right, because you have `if(!rs.next())`. If you change this to
`if(rs.next())` this code block won't be executed.
More information about the Digitalmars-d-learn
mailing list