Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes 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
Marshal
Posts: 35279
384
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic