Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 22nd, 2004, 06:14 AM
XXL XXL is offline
Authorized User
 
Join Date: Dec 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple Delete Records With CheckBox

I'm working on a project for my school and i want to make it possible to delete several records at once.
Problem is I'm just a bigginer with ASP 3.0
So if you can help me I will be very grateful

 
Old December 22nd, 2004, 01:44 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

You could run a query to get all the record primary keys and create a list of checkboxes in a form using this with names like DeleteRecord1, DeleteRecord2, ... (the 1, 2 etc being the primary key of each record).

Then on the page the form is submitted to, loop through the Request.Form collection and check for any fields that have a name that matches this naming convention & execute a delete query.

HTH,

Chris

 
Old December 22nd, 2004, 09:23 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,

  Loop thru recordset and form the checkboxes with the value contains primary key field. Assign the same name to all checkbox(ex:chk1).When u submit the form, the checkbox values are passed with a comma seperated values. Those checkboxes are clicked onlu those Values of the checkboxes passed.

So, u split the string into an array and do u r coding.



---------
Rajani

 
Old December 23rd, 2004, 01:03 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

http://dmxzone.com/ShowDetail.asp?NewsId=3369 -- You might want to read this! It has a working example .. just go through it .. am sure you would understand it yourself.

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old December 23rd, 2004, 02:51 PM
XXL XXL is offline
Authorized User
 
Join Date: Dec 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I got it working. Thx so much!

 
Old December 29th, 2004, 08:46 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

XXL

Glad you go it working. I would like to add to rajanikrishna's post: Coding the same named checkboxes is a very handy and quick way to post a comer delimited string (of the checked values) to the destination page. I would like to give you an example of a DELETE WHERE IN statement (there is no need to split the string etc)

sql = "DELETE FROM tblName WHERE ID IN (" & request.form("idString") & ");"



Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP Multiple delete Checkbox joepublic JSP Basics 1 February 17th, 2005 02:57 PM
How to delete the Multiple Records Using Checkbox tks_muthu Classic ASP Databases 4 February 10th, 2005 03:19 AM
How Can I Delete Multiple Records From a Table? Lucy SQL Server 2000 5 May 12th, 2004 05:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.