0

I am developing a web application that retrieves records from a database and sorts them by a number field.

I would like to run a script every 24 hours to randomly update the number field for all records so that each day the list gets sorted randomly.

I'm using Visual Studio 2012 Express and the Database is SQL Server.

Seems like it should be simple enough but my mind is boggled on how to accomplish this.

My background tells me I could just create a new table with a field to log the current time. Then every-time A user opens the webpage I could check the field and compare it with the current time to see if more then 24 hours have passed.. If so then I could recalculate the random number field. And update the time in my new table.

I know this is really inefficient I don't need to keep checking the database for every user that uses the webpage if I can get the server to run the script once every 24 hours. I just don't have any background on the tools and or methods I need to use to accomplish this.

Trevor
  • 16,080
  • 9
  • 52
  • 83

1 Answers1

2
  1. Just write a console application and run it as a scheduled task every 24 hours.
  2. Or write a Windows Service that has a timer that goes off every 24 hours.
John Saunders
  • 160,644
  • 26
  • 247
  • 397