Hi there I wish to run the following code every day at 9 am. Basically, the code will read a txt file and from each line. It will process and insert into a Mysql table. How do I accomplish this? I have found the following Make server automatic run asp-script every day but it is not working. Please help.
<%
strFileName = "database/testdata.txt"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
set fs = fso.OpenTextFile(Server.MapPath(strFileName), 1, true)
if not fs.AtEndOfStream then
Do while not fs.AtEndOfStream
strRow = fs.ReadLine
sDate = Mid(Trim(strRow), 1, 8)
Set rstTMClk1 = server.CreateObject("ADODB.RecordSet") '=== Transfer from file to TMCLK1
sSQL = "select * from TMCLK1 '"
rstTMClk1.Open sSQL, conn, 3, 3
if rstTMClk1.eof then '=== To avoid duplicates
sSQL = "insert into TMCLK1 (DT_WORK) "
sSQL = sSQL & "values ("
sSQL = sSQL & "'" & fdate2(sDate) & "'"
sSQL = sSQL & ") "
conn.execute sSQL
end if
pCloseTables(rstTMClk1)
Loop
end if
pCloseTables(fs)
%>