Skip to content
Advertisement

Android :java.sql.SQLException: No current row in the ResultSet

I am getting the following error when i try to execute my query(s),but i don’t know why it gives me the following error every time i try to execute my query(s).The error also appears in my logcat and not in a toast as i expected.

here is my code!!

I have tried removing while and replacing it with if statement but it showed me the same error. I also tried my query on mssql and it executed successfully.

EDIT I solved it by changing the date format to MM/dd/yyyy. But now i get the following error:

Any ideas?

Advertisement

Answer

Looks like there is no null check for rs2 in the below line so could throw that error:

Also a better way to check for ResultSet not returning anything is like this:

Read more: https://javarevisited.blogspot.com/2016/10/how-to-check-if-resultset-is-empty-in-Java-JDBC.html#ixzz6KIFZZHNB

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