Database update
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=1015
Printed Date: 29 March 2026 at 9:49am Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: Database update
Posted By: Scott07
Subject: Database update
Date Posted: 14 March 2003 at 2:23pm
How do i get a file to run every hour to update a database, its for my game yo update scores earn money ect and i want it to run every hour, the closest i have been able to get to it is by storing the time of the last update and running the file on every page which checked to see if it was time for the next update. Is there a better way i can do theis then?
------------- http://www.worldsofwar.co.uk - Worlds of War II
|
Replies:
Posted By: MorningZ
Date Posted: 14 March 2003 at 2:30pm
Setting up a scheduled task is the solution, there is nothing coding asp-wise that can be done to make sure its done on the hour...
but your method is pretty good..... if no one is there to see the page and an update doesn't happen, it well upon next hit
------------- Contribute to the working anarchy we fondly call the Internet
|
Posted By: Scott07
Date Posted: 14 March 2003 at 2:36pm
|
not even in the asp.net stuff? I dont mind how its done as long as it works and i dont have to be online 24 hours a day clicking a bug update button every hour
|
Posted By: sespark
Date Posted: 14 March 2003 at 2:45pm
|
The best way to do with asp would be to work your code so that it checks how much time is passed since the last time this function has run. If it has been an hour, then it can do the updating before it does anything else. If it has been more than an one hour, make it call the update repeatedly until it has caught up with the number of hours pasted. Otherwise do nothing. You could possible create something within an sql server to do that, a task per se, but I wouldn't know how to do that, and if you already know asp, it's a hassle to learn something else when you can do with asp. ASP can only run when it is called. It's compiled whenever someone tries to access the page in question. Unless you have IIS setup with caching. I hate caching. *shudder* That means it saves your ASP basically, so that it will compile only once for 10+, 100+, or more runs, and it will not update itself from the asp file until it has been called that many times.
|
Posted By: Scott07
Date Posted: 14 March 2003 at 3:40pm
|
so basicially in short the best way to do it, is the way i have been doing it where the function is run with every page and if it needs updating then it updates it
|
Posted By: MorningZ
Date Posted: 14 March 2003 at 4:06pm
thats correct... because since IIS and serving up ASP pages is a passive thing, requiring some sort of action against it... there is no ability to natively run a task at a given time
as mentioned (and it appears you even remotely looked into it), there is a "Scheduled task" available that would do this.. but its up to you to spend a little effort to see if its doable
as for caching.. there's good times and bad times for it
------------- Contribute to the working anarchy we fondly call the Internet
|
Posted By: michael
Date Posted: 14 March 2003 at 4:33pm
|
well there are task scheduler which are components and there is a very good one in .net. Depending on the database u use, if it's sql you can setup a job to run an update script or whatever you do at certain times, not hard to do if your host allows it.
|
Posted By: boyohboy
Date Posted: 01 April 2003 at 2:08pm
|
ohk thanks Michael.
------------- Visit my community website @
http://www.everythingviet.com - EverythingVIET.com
|
|