• Post Reply Bookmark Topic Watch Topic
  • New Topic

Prepared Statement with Where clause is not working

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi There
I have a table in which I am inserting value on a table using following command this is my method.



But this query showing error

Where I am wrong?


Thanks
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36032
432
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kishor,
What is the exact error message?

Also, note that the convention is to use camelcase for variable names in Java. This means they begin with a lowercase and subsequent words use uppercase. Sp Contact_Name1 would be contactName1. I recommend starting to practice using this convention so you develop good habits.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah after reading about prepared statement and update query now it is sorted out and solved
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36032
432
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great. What was the problem/solution?
 
Ron McLeod
Saloon Keeper
Posts: 1296
149
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Great. What was the problem/solution?

Probably removing the WHERE Phone_no=? clause;
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36032
432
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron McLeod wrote:
Jeanne Boyarsky wrote:Great. What was the problem/solution?

Probably removing the WHERE Phone_no=? clause;

Oh. Of course. Because inserting a new row doesn't apply to other rows. In hindsight, that was obvious.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
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!