 |
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
|
|
|

February 22nd, 2004, 02:39 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

February 22nd, 2004, 02:56 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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
|

February 22nd, 2004, 05:51 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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.
|

February 22nd, 2004, 06:44 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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:
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.
|
|

February 22nd, 2004, 07:20 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
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.
|

February 22nd, 2004, 07:24 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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.
|
|
 |