[thelist] asp checkboxes help

Jason Handby jasonh at corestar.co.uk
Wed Nov 10 10:39:41 CST 2004

> I create dynamic checkboxes based on how many services are in 
> a ADO recordset.
> If there is one service then the service will be listed with 
> a check box next to it. The checkbox's value=rsService("ID") 
> IF there are multiple services then each is drawn with a 
> corresponding check box.
> How do I retrieve the multiple checkbox values if there is 
> more than one service?
> I currently do this:
> DIM servicelist
> servicelist = request("serviceid")
> This gives me a comma separated string of values. (there is 
> only a comma if more than one service) Now what?
> The end result is to retrieve the service id(s) so I can go 
> to the database and delete the service(s).
> I am using asp, javascript.
> any ideas??

If you're just going to delete them from the database then you can just put
your comma-separated list straight into your SQL query. SQL will let you do

	DELETE FROM services WHERE ServiceID IN (3,4,5,8)

So all you have to do is to get your comma-separated string and put it in
the brackets after IN. Something like

	s = 'DELETE FROM services WHERE ServiceID IN (' + servicelist + ')'

and then execute the query using ADO or whatever.


More information about the thelist mailing list