Muha Hassan wrote:I want the number of Jlabels to be the same as the Number columns in the database.
I don't know how your table is setup. But working with rows rather than columns in this particular case will simplify your coding a whole lot.
For row based result set
Of course you want to put your result set in a list for the GUI to use rather than writing sql (doing DB stuff) directly in GUI classes.