Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete.asp won't show delete until refresh

Status
Not open for further replies.

Castanz

Programmer
Apr 5, 2002
61
0
0
US
I was wondering if someone could help me out on this. I have searched all day and can't find an answer.

I have one delete.asp file that pulls from a data base and allows me to select a record to be deleted. Here is the code:
<%
Dim Conn, Rs, sql
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set Rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Conn.Open &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & Server.MapPath(&quot;/forms/aimd/aimd.mdb&quot;)
sql= &quot;SELECT * FROM Mishap_tbl;&quot;
Rs.Open sql, Conn
Response.Write &quot;<FORM name='Delete' method='post' action='Delete-rec.asp' onsubmit='return confirmdel()'>&quot;
Response.Write &quot;<table border=1 cellspacing=0>&quot;
Response.Write &quot;<tr>&quot;&&quot;<td colspan='5' align='center'>&quot;&&quot;Select a Record to <b> delete </b> and click delete&quot;&&quot;</td>&quot;&&quot;</tr>&quot;
Response.Write &quot;<tr>&quot;&&quot;<th align='center' colspan='2'>&quot;&&quot;Last Name&quot;&&quot;</th>&quot;&&quot;<th align='center'>&quot;&&quot;First Name&quot;&&quot;</th> &quot;&&quot;<th align='center'>&quot;&&quot;Report Date&quot;&&quot;</th>&quot;&&quot;<th align='center'>&quot;&&quot;Record ID&quot;&&quot;</th>&quot;&&quot;</tr>&quot;
if NOT Rs.EOF then
Do While not Rs.EOF
Response.Write (&quot;<tr>&quot;)
Response.Write (&quot;<td>&quot;&&quot;<input type='radio' name='IDKey' value=&quot;&Rs(&quot;ID&quot;)&&quot;>&quot;&&quot;</td>&quot;)
Response.Write (&quot;<td>&quot;&Rs(&quot;LastName&quot;)&&quot;</td>&quot;)
Response.Write (&quot;<td>&quot;&Rs(&quot;FirstName&quot;)&&quot;</td>&quot;)
Response.Write (&quot;<td>&quot;&Rs(&quot;RDate&quot;)&&quot;</td>&quot;)
Response.Write (&quot;<td>&quot;&Rs(&quot;ID&quot;)&&quot;</td>&quot;)
Response.Write (&quot;</tr>&quot;)
Rs.MoveNext
Loop
else
Response.Write(&quot;No records found&quot;)
end if
Response.Write(&quot;<tr>&quot;&&quot;<td colspan='5' align='center'>&quot;&&quot;<input type ='submit' name='submit' value='Delete selected record'>&quot;&&quot;</td>&quot;&&quot;</tr>&quot;)

Response.Write &quot;</table>&quot;
Rs.Close
Set Rs = Nothing
Set Conn = Nothing
Response.Write &quot;</form>&quot;
%>
</body>
</html>

The delete works fine. The Delete-rec.asp page works fine and deletes the page. The Problem: When the user presses &quot;back&quot; to view the record he just deleted, the record is still there. If the user presses refresh, he then can see that the record is gone. How do I make the record disappear imediatly? Next question: How do I order the list by record ID?

Any help would be greatly appreciated. This site is awsome.

Thanks,
Al

 
Well, what you said generally happens if using things. One way would be remove the page from the cache using :

Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader &quot;pragma&quot;, &quot;no-cache&quot;
Response.addHeader &quot;cache-control&quot;, &quot;private&quot;
Response.CacheControl = &quot;no-cache&quot;

Atleast, this way the user will see a &quot;Page has Expired&quot; and will need to hit refresh anyway.

Regards
Satish
 
why not instead of the user pressing back not have the form upon submitting it redirect back and solve the problem that way...

pinky1.jpg width='75' height='75'
[/tt]
056.jpg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top