Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 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 February 22nd, 2004, 02:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default Auto Refresh

How can auto refresh the ASP page ?

update page code
----------------

contractno=Request.Form("contractno")
contname=Request.Form("contname")
pstatus=Request.Form("pstatus")

// connection string


usql1="update contracts set "
usql2="contractno='"& contractno &"',"
usql3="contname='"& contname &"',"
usql4="pstatus='"& pstatus &"' where rec_id='"& rec_id &"'"

usql=usql1+usql2+usql3+usql4


cn.Execute usql
if err.number=0 then
Response.Redirect("records_list.asp")
else
Response.write("Wong entry")
end if
%>

it received value from records_list.asp page, after update the record, it redirect to record_list.asp page
but after update the records it des not display updated value until and unless press refresh button, why ?

How can auto refresh the asp update page ?

Mateen










 
Old February 22nd, 2004, 02:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Mateen,

I am surprised, why you wanted to refresh the page again.

Response.Redirect("records_list.asp") should be enough to refresh the page. I wonder if something is wrong with your records_list.asp

May be seeing the code from records_list.asp would help.

Cheers


-Vijay G
 
Old February 22nd, 2004, 05:51 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The page is probably cached by the browser, so you're looking at an old version of it, from the browser's cache. Add the following code to the top of the page, to prevent caching:
Code:
<%
  Response.ExpiresAbsolute = #1/1/1980#
  Response.AddHeader "pragma", "no-cache"
  Response.AddHeader "cache-control", "private, no-cache, must-revalidate"
%>
Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 22nd, 2004, 06:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks.

now there is no need to click the refresh button, it
refresh the page when it redirect to that page.

you like to inform me, it is due to old internet explorer or
old visual studio version ?
(I am using visual studio 6.0 and IE 6.0.2800.1106 windows xp)

regards.

Mateen



Quote:
quote:Originally posted by Imar
 The page is probably cached by the browser, so you're looking at an old version of it, from the browser's cache. Add the following code to the top of the page, to prevent caching:
Code:
<%
Code:
  Response.ExpiresAbsolute = #1/1/1980#
  Response.AddHeader "pragma", "no-cache"
  Response.AddHeader "cache-control", "private, no-cache, must-revalidate"
%>
Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 22nd, 2004, 07:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Simply use
Code:
<meta http-equiv="refresh" content="1">
within ur <head>.
or use
Code:
window.location.reload();
within ur JavaScript codes.
HTH.

Always:),
Hovik Melkomian.
 
Old February 22nd, 2004, 07:24 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

No, it's because how Internet Explorer (and other browsers) work. They keep a copy of the page for quicker access when you return to the same page. Many pages are relatively static, and don't change(much) so there is no need to retrieve the latest version from the server every time you visit the page.

However, dynamic pages, like this one, need to be retrieved from the server every time. The code I showed makes sure that the browser sees the pages as outdated as soon as it loads it, so it will get a fresh copy when you rerequest it.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
auto-refresh page with asp? nlicata Classic ASP Basics 4 October 6th, 2015 01:52 PM
Auto-refresh user control in .NET 1.1 r_adarsh .NET Framework 1.x 2 February 1st, 2008 05:51 AM
Auto Refresh and Auto Delete deontae45 VB.NET 2002/2003 Basics 1 September 29th, 2006 04:53 PM
Auto refresh arnabghosh Classic ASP Basics 1 December 21st, 2005 04:33 AM
Javascript to replace auto refresh ? Mantis Java Databases 0 October 22nd, 2005 06:22 AM





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