• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

delete multiple records using checkboxes

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, I have a dynamic list of data, next to each is a checkbox with specific data as the value,



I want to pass all of the values from this to another page that will place them into an SQL statement and perform and action on the rows of data. Right now I place all of the values into a string, seperated with commas. This produces an output like this

variable=102,103,104,105

as a string. I attempt to place this into a "where in" clause, but it doesnt like it

where in variable

which equals

where in 102,103,104,105

in stead it sees it as one entity

where in '102,103,104,105'

Can anyone help me with this, I know it can be done, it is done in web based email clients and shopping carts all the time, I am just at a loss on making it work!

thanks!
-Bob
 
Bob Rocks
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oops, I figured it out, I am just a moron!
 
author & internet detective
Posts: 41860
908
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
Bob,
Could you post the solution so others reading this post in the future know what the solution was? I think it has to do with a Statement vs PreparedStatement.

Welcome to JavaRanch!
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bob Wiscott:
oops, I figured it out, I am just a moron!

where in '102,103,104,105'


Jeanne,

" where in '102,103,104,105' " Should be in this way

" where in ('102','103','104','105') "

This 'll solve the problem ....
[ November 08, 2004: Message edited by: srini vasan ]
 
Bob Rocks
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure I'll post my code!

Page one needs to create the checkboxes (all the same name)

Page two then needs to place them in a string;


you can then use the string in your sql statement



this should work with prepared statements OR regular statements, all I tested was prepared.

I hope this helps somebody!

PS thanks for the efforts Srini, but we had that part, we actually needed the question to the answer! Think 42!

[ November 09, 2004: Message edited by: Bob Wiscott ]

[edited by jeanne to add line break]
[ November 09, 2004: Message edited by: Jeanne Boyarsky ]
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
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
Thanks Bob!

we actually needed the question to the answer! Think 42!

 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
reply
    Bookmark Topic Watch Topic
  • New Topic