Skip to content
Advertisement

I’m trying display severeal lines from a database in NetBeans, but only one line appears

I’m currently having to do a code where, when ran, connects to a database and displays all the grades of a student after putting in their appropriate SSN. The main obstacle I’m running into is that once I put in the SSN it’ll only bring one of the grades rather than all. Is there something wrong with my logic? Am I just utilizing incorrect parts to do this? I’ve tried putting more than one lblstatus but that didn’t work. Here’s the code:

Advertisement

Answer

You have used if which is getting executed only once and therefore, you are getting only one record.

Replace

with

Note that using while, you create a loop which will keep iterating until the condition, rset.next() remains true i.e. until the resultset has more elements.

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