Deleting multiple records

Results 1 to 3 of 3

Thread: Deleting multiple records

  1. #1
    Join Date
    Dec 1969

    Default Deleting multiple records

    Hi all...I am trying to display a recordset(which I know how to do) and then have a check box next to each, what I want to do is have one pass to delete records. For example, <BR><BR>checkbox1, fields1....<BR>checkbox2, fields2...<BR><BR>So if checkbox1 and checkbox2 is checked, I want to run the following SQL...<BR><BR>Delete <BR>from table<BR>where fieldname = checkbox1 or checkbox2...etc. <BR><BR>Can anyone point me to the right direction?<BR><BR>thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: Deleting multiple records

    try<BR><BR>Delete <BR>from table<BR>where fieldname in (checkbox1, checkbox2...)

  3. #3
    Aaron Trahan Guest

    Default RE: Deleting multiple records

    server-side VBScript<BR>Where "Feature" is the name of the field.<BR>Body:<BR>&#060;%<BR>&#039; use your data base data here<BR>for i = 0 to MaxCheckBox<BR>%&#062;<BR>&#060;input type="checkbox" name="Feature" value=&#060;%=i%&#062;&#062;&#060;%=i%&#062;<BR><B R>&#060;% <BR> Next<BR>%&#062;<BR>&#060;input type="Submit" name="Delete" value="Delete"&#062;<BR><BR><BR>Top code:<BR>&#060;%<BR>&#039; if they have pressed the "Delete" button<BR>if not isempty(Request.Form("Delete")) then<BR> Features = Split(Request.Form("Feature"), ",")<BR><BR>&#039; loop thru. and delete each one that had been checked<BR>for i = 0 to UBound(Features)<BR> Delete from table where fieldname = Features(i)<BR>next <BR><BR>end if<BR>%&#062;<BR><BR>The value of the form box called "Feature"<BR>Request.Form("Feature") will be a comma delimatted set of numbers.<BR>For example 3,5,7,10<BR>So you use the Split function to seperate the values into an array. Which would yield:<BR>Features(0) would be 3<BR>Features(1) would be 5<BR>Features(2) would be 7<BR>Features(3) would be 10<BR>UBound(Features) would equal 3<BR><BR>I hope this helps.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts