Skip to content
Advertisement

why if i make JTable take data from database delete the first row?

I’m trying to make a Table take the data where I make condition a delete from … to … , the data returns one row thinner, maybe one row deleted? my code:

JavaScript

enter image description here

Advertisement

Answer

the data come to me less thin a one row

JavaScript

You read the first row outside the loop, so it is never added to the model.

Your logic should be something like:

JavaScript

That is check the number of rows added to the model after iterating through the ResultSet.

Or, maybe you could use:

JavaScript

I’m not an SQL expert, so I’m not sure what that will return on an empty ResultSet.

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