Deleting Records

Results 1 to 2 of 2

Thread: Deleting Records

  1. #1
    Join Date
    Dec 1969

    Default Deleting Records

    I&#039m having a problem with deleting multiple records from a database, but the changes not being "reflected" right away. I&#039ve got a routine that allows a user to delete multiple records at one time (the code that does this to follow) from a screen that lists all of the records. Once the process is finished that deletes all of the records they selected, it then does a Response.Redirect back to that same page where it lists all the records.<BR><BR>The problem is, when it gets back there, sometimes there are records listed that are ones he asked to delete. Now if I look in the database, the records are gone. And if I press "refresh" on the browser, they disappear. Some of the ones he requested be deleted are gone the first time. I&#039m using Response.Expires = 0 to force the browser not to cache.<BR><BR>any thoughts on what the problem might be? I&#039ll post the source code of the routine that deletes the multiple items at one time below: (the code itself works fine, I&#039ve tested it thoroughly. It always deletes the records it is supposed to)<BR><BR>&#060;%<BR>FOR i = 1 TO Request.Form("itemcount")<BR>currentitemnum = "unisource" & i<BR>currentitemqty = "quantity" & i<BR>%&#062;<BR><BR>&#060;% <BR>If Request.Form(currentitemqty) = 0 Then<BR>%&#062;<BR><BR>&#060;% <BR>If NOT isempty(sDelete) then sDelete = sDelete & ","<BR>sDelete = sDelete & "&#039" & Request.Form(currentitemnum) & "&#039"<BR>%&#062; <BR><BR>&#060;% End If %&#062;<BR><BR>&#060;%<BR>NEXT<BR>%&#062;<BR><BR>& #060;% <BR>If NOT isempty(sDelete) Then<BR>Set Conn = Server.CreateObject("ADODB.Connection") <BR>Conn.Open "advantagetemp"<BR>vSQL = "DELETE FROM Temp WHERE SessionID = &#039" & Session.SessionID & "&#039 AND Unisource IN (" & sDelete & ")"<BR>Conn.Execute vSQL <BR>Conn.close <BR>End If<BR>%&#062; <BR><BR>&#060;%<BR>Response.Redirect "cart.asp"<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Deleting Records

    From:<BR><BR><BR>Try this code the pages you need to NOT be cached by the browser:<BR>&#060;%<BR> Response.Buffer = True<BR> Response.ExpiresAbsolute = Now() - 1<BR> Response.Expires = 0<BR> Response.CacheControl = "no-cache"<BR>%&#062;<BR><BR>Also check out this article:<BR><BR><BR>Happy Programming!

Posting Permissions

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