7
I’m looking to run a script that records information into the database every 24 hours. I’m not the server administrator, so I don’t have access to Scheduled Tasks
, I read in some articles that I can use Global.asa
for every time the site is visited (using Session_onstart), count 24 hours and run the script.
I tried to apply this form but it didn’t work; Follows the code in classic Asp:
<!-- #include file="etc/conexao.asp" -->
<script language="vbscript" runat="server">
Sub Session_OnStart
'Runs on application start or after 15 minutes
If Application("LastRun") = "" Or DateDiff(n, Application("LastRun"), Now()) > 15 Then
set RS = server.CreateObject ("ADODB.Recordset")
set RS2 = server.CreateObject ("ADODB.Recordset")
'exemplo de query que irá roda:
RS2.Open "SELECT numero from PI_TESTES WHERE ID = 5",conn,1
numero = RS2("numero")
numero = numero + 2
RS.Open "UPDATE PI_TESTES SET numero = '"&numero&"' "+_
"WHERE ID = '5' ",conn,1
Application("LastRun") = Now()
End If
End Sub
</SCRIPT>
If anyone has any other solution, I am also willing to adopt.
Does it involve a web system? Can I propose a solution that uses your hosted site.
– Maicon Carraro
It’s intranet, I can’t use "external solutions/services" @Maiconcarraro :)
– dHEKU