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

How to refresh a Web site and hence the databases it uses?

Status
Not open for further replies.

kelant

MIS
May 26, 1999
4
CA
I am using ASP in my Web site with Access databases. Occasionally, I need to refresh (restart) the site to reset some parameters as well as to update the databases. Will the Sub Application_OnEnd do the job? How can I force an "OnEnd"? In fact, do I need to refresh the site at all?<br>
I am new to the Web application development with databases. Is there some general rules of thumb to handle database updates/maintenance?<br>
Your comments are greatly appreciated.
 
Hi kelant,<br>
<br>
You say you need to update a database - this should be nothing to do with ASP. ASP is merely a way to query a database. You don't need to go near the global.asa to do this. Just refresh the database in the normal manner that you would.<br>
<br>
As to the parameter you want to change, what are these paramaters? Are they databases (if so not an ASP problem).<br>
<br>
Remeber an ASP page will always point to the same databse as long as when you update it you don't change passwords/locations etc.<br>
<br>
Let me know if this helps<br>
<br>
G
 
Hi qms,<br>
Thanks for the comments but I still have problem. Maybe I repeat the problem in the following way:<br>
- I use ASP's Application_Onstart to take data from a master database and create a number of working tables in memory for my site's processing.<br>
- Each user coming to my site will trigger a Session_Onstart and exit with a Session_Onend. I use those sub routines to do data setup and cleanup, respectively.<br>
- I do not have Application_Onend since I have nothing to do at the exit point. (In fact, I do not really sure when the Application_Onend will be executed! Is it after all sessions are ended?)<br>
- My problem is to find a way to trigger the re-run of Application_Onstart after each database refresh such that the inmemory data can be refreshed accordingly. But I failed to do that in numerous tests until I asked my host site's administrator "redefining" (don't really know what exact they did!) the database resource file. There must be a way for me to do this simple refresh. How? Can anybody help?
 
Kelant,<br>
<br>
Reading the help file on Application_Onstart and Application_OnEnd, here is what I gleened. The Application_Onstart will fire when the first user opens the first web page anywhere in your project directory. After that it won't fire as each page is opened by each user. The Application_Onend will fire when you shutdown the server (hopefully a rare occurance). So to get this to happen more regularly, you'll probably need to come up with a different method.<br>
<br>
I am not sure what the best approach is for what you are trying to accomplish. Having the data is local tables is going to mean the data will get out of sync everytime the master is updated. Is there a way you can avoid the local tables altogether? If not, is there a way to schedule a task in IIS that will refresh this data on a regular basis?
 
Kelant, if I read your question correctly I can't help but cringe at the design. You should *never* store that much data in an Application level variable or...<br>
1) as long as a single user is connected to your App, the App_OnStart will never fire again and you won't get a fresh copy of the DB loaded and <br>
2) You use sooooo much more memory to store "working tables", (I read this as meaning Recordset objects), in Application scope. In fact, Microsoft specifically recommends against doing this if you have any hope of scaling you application.<br>
<br>
Instead of overusing Application variables, try this, write a few procedures/functions that create html tables or recordsets (you can use a feature new to ADO 2.0, disconnected recordsets, to return a recordset from to a function call; use the Set statement at the end of the function). Anyway, store these subs/funcs in an include file, reference the include file throughout your app and call the subs only when you need to. Additionally, you can use the Resync method on the Recordset object to refresh it against the source table/query should that be necessary.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top