Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to edit a row

 
James Eman
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have a program that asks questions and then submits the number of correct response to a database(MYSQL). Keeps saying


Here is my code


y is the row the user is located and x is the number of questions they got right.
Any suggestions i'm not the greatest in MySQL yet but i am trying to teach myself.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35976
422
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
st.executeQuery is for select statements. st.executeUpdate is for insert/update/delete statements.

The error message does hint at this with "Can not issue data manipulation statements with executeQuery()." It just doesn't tell you the fix. As you learn about JDBC, look into PreparedStatements. They are easier to use when setting parameters. And safer too - you don't have to worry about evil users attacking your database with SQL Injection.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!