Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

delete multiple records using checkboxes

 
Bob Rocks
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
oops, I figured it out, I am just a moron!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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!
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • 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
  • 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
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic