| Author |
Topic Search Topic Options
|
Scott07
Groupie
Joined: 04 July 2002
Location: United Kingdom
Status: Offline
Points: 43
|
Post Options
Thanks(0)
Quote Reply
Topic: Database update 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?
|
|
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
Scott07
Groupie
Joined: 04 July 2002
Location: United Kingdom
Status: Offline
Points: 43
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
sespark
Newbie
Joined: 13 February 2003
Location: United States
Status: Offline
Points: 6
|
Post Options
Thanks(0)
Quote Reply
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.
|
 |
Scott07
Groupie
Joined: 04 July 2002
Location: United Kingdom
Status: Offline
Points: 43
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
michael
Senior Member
Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
|
Post Options
Thanks(0)
Quote Reply
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.
|
 |
boyohboy
Groupie
Joined: 15 October 2002
Location: United States
Status: Offline
Points: 197
|
Post Options
Thanks(0)
Quote Reply
Posted: 01 April 2003 at 2:08pm |
|
|
|
|
 |