deleting selected items from using asp
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=24156
Printed Date: 29 March 2026 at 12:35am Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: deleting selected items from using asp
Posted By: trickstar
Subject: deleting selected items from using asp
Date Posted: 12 August 2007 at 8:46pm
At present users are able to select one to delete by clicking on ID number which is passed on for deleting, users have to do this one at a time.
I want users to be able to select database record/s using check boxes to delete from database.
I am new to asp and need some help.
|
Replies:
Posted By: Scotty32
Date Posted: 13 August 2007 at 6:02pm
you can do it by having the checkbox to all have the same name
this will make the IDs look like so
1,2,3,4,5
you can then split the string up like so:
strCheckbox = Request.Form("checkbox") strAryWords = Split(strCheckbox, ",") Dim iLoop For iLoop = 0 to Ubound(strAryWords) strSQL = "DELETE FROM table WHERE id = " &
strAryWords(iLoop)" conn.execute() Next
|
it could be buggy as i did it off the top of my head - so you might want to test it out a bit
------------- S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins
For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .
|
Posted By: trickstar
Date Posted: 15 August 2007 at 12:30am
|
Thanks. I'll give it a go.
|
Posted By: Scotty32
Date Posted: 15 August 2007 at 8:11pm
it appears i made a tiny typo in the SQL statement, either delete the quote after strAryWords(iLoop) or change it to:
strAryWords(iLoop) & ""
------------- S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins
For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .
|
|