• 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:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

javafx jdbc problems with delete

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
author & internet detective
Posts: 42105
933
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
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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 42105
933
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
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?
 
Maybe he went home and went to bed. And took this tiny ad with him:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic