Skip to content
Advertisement

Using Java check to determine if there is data in mySQL table before updating table

I am new to Java and am trying to see if the date (actually day of week) column in MySQL contains the date before updating the table. If the date already exist the table should not be updated and if the date doesn’t exist the table should be updated. I’ve tried different code. My prior code either updated or didn’t update the table depending on whether I has “!rs.next()” or “rs.next()” instead of depending on whether the date was in the table.

JavaScript

My current attempt doesn’t update my table at all.

JavaScript

Any help would be appreciated.

Advertisement

Answer

I got it to work. Instead of “rs.first();”, I changed it to “rs.next();”. Now my code doesn’t post anything unless the date currently isn’t being used.

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