wood burning stoves 2.0*
The moose likes JDBC and the fly likes delete multiple records using checkboxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "delete multiple records using checkboxes" Watch "delete multiple records using checkboxes" New topic
Author

delete multiple records using checkboxes

Bob Rocks
Greenhorn

Joined: Oct 21, 2004
Posts: 23
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

Joined: Oct 21, 2004
Posts: 23
oops, I figured it out, I am just a moron!
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

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!


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
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 ]

Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Bob Rocks
Greenhorn

Joined: Oct 21, 2004
Posts: 23
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

Thanks Bob!

we actually needed the question to the answer! Think 42!
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: delete multiple records using checkboxes
 
Similar Threads
Delete doubt
Checkbox value not being passed to bean.
reading a nested list with javascript
Kindly help me with this checkbox issue
Why is request.getParameterValues not working for me?