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

javafx jdbc problems with delete

 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends in javafx i have problems with delete in delete row selected.

i have write this code:



don't delete row selected!! where is the problem???

help me please!
 
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
Can you try running this code? (I might have a typo; I didn't run it.) The idea is to
1) Use a bind variable so PreparedStatements are used properly
2) See if the database can find a match for that id.

 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!

thank's for answer

i edit code:



show this error:

Parameter index out of range (1 > number of parameters, which is 0).

help!


 
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
That's because the string should be:


The idea is to let Java handle the bind variables for you. Which is good practice and prevents people from running a SQL injection attack on your database. I don't actually think that is the reason your code isn't deleting

Did the select return anything?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic