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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic update 1

Status
Not open for further replies.

pet41

Programmer
Sep 13, 2005
16
NO
Hi

I am making a application (in vb) to automatic update WEB page using MS SQL server. So fare so god. I am updating both picture and text.
My question is: Is it possible to automatic refresh asp page when there are new data on the SQL server

Thanks Rune
 
Depends what you mean. The asp has no way of telling the browser there is new data and then refresh, all you can do is set it to refresh the browser every 10 minutes or so using the refresh meta tag

}...the bane of my life!
 
pet41, are you building the entire page dynamically from the database or just using code to insert data into a template from the database?

You have to worry about both server side and client side caching. What I would suggest is to have your html template files use includes. The include files should be set not to cache and would execute the code to pull the data from the database.
The client browser will never cache server side code anyway but this way the templates and related files can cache normally for better performance but the dynamic content will not cache.

Performance could become an issue if it is a really busy site. You would have to look into what controls you have for flushing server side caching if you had to deal with performance issues.


Paranoid? ME?? WHO WANTS TO KNOW????
 
You could use a trigger (insert and/or update) on your database to write a timestamp to a textfile every time the table is changed. Your asp would read the timestamp from the file and dynamically write the value into a client-side javascript variable.

Then you could use client-side script to create an instance of the xmlhttp object... a timer in the script would then ask the object to read the textfile on the server, parse the date to see if it is different and reload the web page if the two dates are not the same.
 
Yes, nice way to handle automatic updates.
I was thinking along the lines of "next time they load the page" rather than triggering updates to a page already loaded.

Any way though of making this work automatically if the client has disabled javascript?

Paranoid? ME?? WHO WANTS TO KNOW????
 
Very nice Sheco. I'll go for that one
 
The only way to make it work automatically with without javascript is to use a meta refresh tag, which would refresh the page regardless.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top