Delete All Record in a search result page?

This is a discussion on "Delete All Record in a search result page?" within the Classic ASP section. This forum, and the thread "Delete All Record in a search result page? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices




Closed Thread
 
LinkBack Thread Tools
  #1  
Old Nov 10th, 2004, 02:03
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Delete All Record in a search result page?

Hai spinal...
I have this page that will displays all the information from a search page.
The user will enter a DATE in the search page and then the result page will display all the DATE that the user requested.

What i want to do in this result page is,
I want to delete all the RECORD/DATA displayed in the result page and then after deleting, the page will redirect to the main page. I dont know how to do that spinal. Could you help me please.

Below is my code for the result page. "bnBookDate" is the search field in the search page.
I tried to use your delete by checkbox in this code but I cannot manage to modify them because after deleting,
we cannot display back the data(which your code does that..) We must redirect the page to another page.

Please spinal...HELP ME!

Result page: This is an action page comes from the search page.
Code: Select all
<%@LANGUAGE="VBSCRIPT"%>

<%
Dim rs__MMColParam
rs__MMColParam = "1"
if (Request.QueryString("bnBookDate") <> "") then rs__MMColParam = Request.QueryString("bnBookDate")
%>
<%
set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_bn_STRING
rs.Source = "SELECT *  FROM BN  WHERE bnBookDate = '" + Replace(rs__MMColParam, "'", "''") + "'"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 3
rs.Open()
rs_numRows = 0
%>
The only thing that I wanted to do in the result page is to delete all the data that are displayed only?
Please help me.........
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old Nov 10th, 2004, 22:13
Junior Member
Join Date: Oct 2004
Location: USA
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Loop through the RS and store the unique identifier into an array, then loop through the array deleting the records...

Example:
Code: Select all
Dim strArray(1)
i=0
if not(rs.eof) then
  do while not(rs.eof)
  strArray(i) = rs("bnID")

  i = i + 1

  ReDim Preserve rsArray(i)
  rs.movenext
  loop

  For i = 0 to Ubound(rsArray)
    strsql = "DELTE FROM BN WHERE bnID=" & rsArray(i)
    MM_bn_STRING.execute(strsql)
    response.write("Record " & rsArray(i) & " Deleted
" & vbcrlf)
   i=i+1
  Next
else
  response.write("No Results")
end if
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Nov 11th, 2004, 03:15
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
What if I do this...
The data wont be display...it only delete them and then redirect them to another page..."delete_success.asp"

Code: Select all
<%
set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_bn_STRING
rs.Source = "DELETE *  FROM BN  WHERE bnBookDate = '" + Replace(rs__MMColParam, "'", "''") + "'"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 3
rs.Open()
rs_numRows = 0
response.redirect "delete_success.asp"
%>
If I want to use your code...Could you tell me where should I put them in my existing code?
Thanx .....
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Nov 11th, 2004, 03:27
Junior Member
Join Date: Oct 2004
Location: USA
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Judging from you're current code you know enough to judge placement, my code wont work by itself, you need to customize it to fit you're needs, that was just an example for you to go off of.

Right after it processes the delete queries, place a response.redirect("whereverYouWantToGo.asp")
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
delete, record, search, result, page

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Record the link you clicked to leave my page TheSealPortalTeam PHP Forum 22 May 5th, 2008 20:05
Printing single record from Access via Report in Web Page Neotekk JavaScript Forum 0 Jun 18th, 2007 15:20
Add/Delete/Modify Database Record form David Blake Starting Out 6 May 1st, 2007 16:22
Delete file in password protected page. SweetLou Classic ASP 4 Jan 7th, 2006 21:15
Delete record problem Gee Bee Databases 2 Jan 4th, 2006 18:28


All times are GMT. The time now is 15:50.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42