Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Asp Q

Options
  • 28-11-2007 3:27pm
    #1
    Registered Users Posts: 1,327 ✭✭✭


    Here's the thing...
    I have a system where users add records,
    What's meant to happen is after 7 days the record is deleted and the user is sent a mail saying their record has been deleted.

    I know how to add records and delete them and send mail, just how to I get this to work autonomously?

    I'm using Asp classic and Mysql.

    How can I achieve this?

    Do I need to get some kind of VB program that will run constantly on my server or is there a way I can do this relatively simply without spending a heap of money?

    If some could point me in the right direction that would be great because I kinda don't know where to begin here.

    thanks.


Comments

  • Registered Users Posts: 3,594 ✭✭✭forbairt


    If it was on a linux machine I'd recommend you run a cron job

    Do you have access to the machine ?


    Here's an article on scheduling tasks you mind find interesting on task scheduling
    http://support.microsoft.com/kb/308569


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    I'd imagine you can put this in a VBS file (the syntax should be very similar) and put it in your scheduled jobs.

    I haven't done this myself on Windows, but I imagine you could have a scheduled job that telnets to the webserver on port 80 and sends a GET request to a page that contains the functions. This will have the same affect as you browsing to the page daily.

    Edit - just tested this - it's very easy:

    Put this in a file with a VBS extension. The <url> should be replaced with the page that will do all the deletes and emails, but doesn't need to output anything (though a mail to the site admin would be useful).
    url = "http://<url>"
    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
    xmlhttp.open "GET", url, false
    xmlhttp.send ""
    set xmlhttp = nothing
    

    Now, just go to the scheduled tasks on the webserver and set it to run whenever you need.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Does MySql have scheduled jobs/tasks? You could do it directly from the db then.

    Other than that Eoin_s VBScript solution sounds good but I would access MySql directly from the script and delete the records from there instead of sending a request to the webpage, this would be far easier and would only require a simple SQL delete statement wrapped in an ADO transaction.


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    Evil Phil wrote: »
    Does MySql have scheduled jobs/tasks? You could do it directly from the db then.

    Other than that Eoin_s VBScript solution sounds good but I would access MySql directly from the script and delete the records from there instead of sending a request to the webpage, this would be far easier and would only require a simple SQL delete statement wrapped in an ADO transaction.

    That's a bit cleaner alright, and nearly identical syntax to what's in the ASP page. Just change

    Server.CreateObject("ADODB.Connection")
    to
    CreateObject("ADODB.Connection")

    and that's pretty much it.


  • Registered Users Posts: 1,327 ✭✭✭Nasty_Girl


    thanks for the replies,

    I don't have access to the machine boo hiss!
    But I could try getting in touch with the hosting provider and ask them about scheduling tasks and stuff.

    I found this link

    http://dev.mysql.com/tech-resources/articles/event-feature.html

    I think it may help me but I'll have to look into it, see what version of mysql i have and so on, it's all a bit crazy i think!

    I'll post how I get on.


  • Advertisement
  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    Nasty_Girl wrote: »
    thanks for the replies,

    I don't have access to the machine boo hiss!
    But I could try getting in touch with the hosting provider and ask them about scheduling tasks and stuff.

    I found this link

    http://dev.mysql.com/tech-resources/articles/event-feature.html

    I think it may help me but I'll have to look into it, see what version of mysql i have and so on, it's all a bit crazy i think!

    I'll post how I get on.

    Do you have access to another machine that you know will always be on? in that case my suggestion will still work. You'd put all the db and email stuff on a page on the server though, not in the VBS file.

    I don't know if MySQL will be able to do the email part of the script automatically.

    I am not 100% sure about this, but I vaguely seem to remember that some hosting providers have this feature where you can provide a page that should be accessed on a regular basis, which is exactly what you need. I'll have a look at my control panel and see if I have that option.

    Edit: found this link - the page is no longer there but it's cached on google, and H365 support forums are bereft of any posts for some reason. Basically, you should be able to log a ticket and they can set it up for you.


Advertisement