• 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
Sheriff
Posts: 36007
422
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
Sheriff
Posts: 36007
422
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?
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
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!