Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 22nd, 2004, 02:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: abu dbabi, , United Arab Emirates.
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










Reply With Quote
  #2 (permalink)  
Old February 22nd, 2004, 02:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
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
Reply With Quote
  #3 (permalink)  
Old February 22nd, 2004, 05:51 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #4 (permalink)  
Old February 22nd, 2004, 06:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: abu dbabi, , United Arab Emirates.
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.
Reply With Quote
  #5 (permalink)  
Old February 22nd, 2004, 07:20 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
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.
Reply With Quote
  #6 (permalink)  
Old February 22nd, 2004, 07:24 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:08 PM.


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