How to clear a database table once a week?

Discussion in 'ASP.NET / ASP.NET Core' started by hscroundsco, Jul 26, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have an appilcation that draws information from an Access file in the App_Data subfolder. Every Monday I want to clear entries a datatable. How should I do this? I'm wondering if I want a "web service" to run within my application on the server, or a "Scheduled Task" from the DiscountASP menu, or something else.
     
  2. Hi,
    In an ASP.NET page?
    This is pretty simple with Access but the danger is there is no roolback unless you copy the records elsewhere first.
    If that's no problem just create a Sub in a page where you select all records in the table.
    Examples here:
    http://msdn.microsoft.com/en-us/library/bb177896.aspx

    Yes you could create an ASP.NET to do that when hit from the DASP Scheduled task.
    All the best,
    Mark
     
  3. Re: How to clear a database table once a week

    Thanks, I think I understand. And it *is* an ASP.NET application.

    So I add a web form, write the Sub for the Page_Load event, and set up the DASP scheduled task manager visit the page once a week?
     
  4. How to clear a database table once a week

    Well *that* didn't work!

    I wrote Visual Studio 2008 code to set all the entries in my table to FALSE, put it in the Page_Load event of a new page, and it works if I manually visit that page by typing in the URL.

    The task ran this morning as scheduled according to the Scheduled Task Manager, but my table entries didn't get set to false. It *is* a password protected page, and I have rechecked the Username and Password to make sure they are correct.

    This is my first "task" so I'm sure it's a stupid mistake. What am I doing wrong?
     
  5. ...How are you sending the login with the URL?
     
  6. Since I don't fully understand your question, that must be where my ignorance lies.

    I am setting up the task on the DASP Scheduled Task Manager page, and filling in the Username and Password boxes with my personal Username and Password for the application (not the DASP Username and Password). Is that how it's supposed to go?
     
  7. The username and password on the scheduled task manager is merely for password protection purposes. It only passes the correct NTFS permission base off the user name you created in the User/Quota manager and the permission set in the Permission Manager. It is not meant to pass any login value that the application itself may need through forms authentication. If this is how your application is setup I'm afraid the Scheduled Task Manager will not be able to run it because it cannot follow http redirects.
     
  8. hscroundsco...
    This doesn't have to be a show-stopper for you.
    With ASP.NET you can do the same as Classic ASP with a URL Query.
    Say for example your task-page is called clearit.aspx and...
    ...you code the Page_Load to not do anything unless the page was called like this:
    /clearit.aspx?pass=true

    Then it should work as you want from the Task, but still have a margin of security.
    All the best,
    Mark
     
  9. I'm using a modified sample Membership Provider that I downloaded, and don't know exactly how it would handle URL queries. I could look, but it sounds like I should just take my page and put it outside the application. I'll see if I can figure out how to do that securely.

    Thanks for your answers.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page