• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to edit a row

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 42134
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic