1

This is what I want to do:

PreparedStatement query2 = 
conn.prepareStatement ("UPDATE report SET Name = ? WHERE Id = ?");

String blah = "Jane";
int id = 1;

query2.setString(1, blah);
query2.setInt(2, id);
query2.executeQuery();

But I'm getting this error:

The statement did not return a result set.

I am new to the whole jdbc world. Where am I going wrong here?

1 Answer 1

5

You should use executeUpdate.

"Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement."

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.