Skip to content
Advertisement

Else statement not executing inside while loop of SQL database

Else statement not working inside while loop

Advertisement

Answer

You could try this and let me know if it works the way you want it to.

We haven’t mentioned any exit condition within the while loop parenthesis, so the loop keeps running till no more records are left to be fetched (else will print Access denied and break) or if access is granted (breaks again).

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement