|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
date
...my system works like this...when the user fill up the registration form..the system will capture the time ...if the person who registered didnt appear in 2 weeks...his/her data in the registration table will be deleted...by the system on its own...how to do this...using sql + asp...plzzz help
|
|
#2
|
||||
|
||||
|
Which part are you asking about? The registration form, or the database update that removes members who have been inactive for 2 weeks? (BTW, you might want to make that more like a month. People could go on vacation or other reasons, and be offline for a couple weeks. They wouldn't want their info deleted every time they go on vacation)
And PLEASE, use proper capitalization and punctuation in your posts. It makes them much easier to read. |
|
#3
|
|||
|
|||
|
-->People could go on vacation or other reasons, and be offline for a couple weeks<--
My god karsh44 how many times a year do you go for 2 weeks vacations or other can I work where you work ![]() j/k hehe... |
|
#4
|
||||
|
||||
|
Its the annual vacation
And if my memberships were cleared after I got back, it would be really annoying, even if it was only once a year. As I think about it more, there are sites I have memberships at which I don't visit every 2 weeks even when I'm home, so unless shalee can be certain that people will visit that often, the time span needs to be longer. |
|
#5
|
|||
|
|||
|
Your problem is one of state (when isn't that a "problem" in ASP).
If I were tasked to do what you are doing, I would write a DLL and run it as a scheduled task. The whole ASP model is event driven; that is to say that you write code to respond to when a user does SOME thing. In this case, you are trying to cause an action to occur (delete records) when a user has done NO thing rather than SOME thing. There are ways of triggering your stored procedure within the ASP model when NO thing occurs, but it's complicated, and it's dependent upon other things. Vlince or untrnang may have a better suggestion than I, but like I said, if it were up to me, I'd write a DLL. From my perspective, it's the easiest thing to do. In task scheduler, set the DLL to run once a day (Can't imagine you'd want it to run any more frequently than that). Inside the DLL, all you have to do is:
Maybe 30 lines of code (including the error trapping should the connection fail, etc). Last edited by zimm : August 26th, 2003 at 11:12 AM. |
|
#6
|
||||
|
||||
|
The dll is a good idea. If you don't know how to do that, though, a quick and dirty method would be to have the delete command run every time someone logs in, so every log in event would cause the query to look for people who have been inactive for a month (or 2 weeks, if you insist).
This would increase the load on the server though, probably to unmanageable levels, unless you don't have many users. Overall, I would definitely recommend the dll route if you can, this was just an easier (to write) alternative. |
|
#7
|
|||
|
|||
|
Quote:
Just thought of another solution, and is probably easier than writing a DLL. Create a new application variable that holds the current date. Create a new application variable that holds the current date + 1. Create a new session variable that holds the date that the user logged on. If session_date = application_date + 1 then application_date = application_date + 1 execute the delete stored procedure End if The only time that the code inside this if block should execute is the first time somebody logs on in a given 24-hour period. Every subsequent logon should have a session-date that is equal to the application_date. This is probably easier than writing a DLL. Last edited by zimm : August 26th, 2003 at 02:30 PM. |
|
#8
|
|||
|
|||
|
one other way is to write a procedure in db and schedule it as a job. That's super easy.
Code:
Create procedure procedure name () is begin delete statement; end; and you can ask your dba to schedule the job for you that can run once a day.
__________________
If you ask a question you are a fool for a second. But if you dont ask, you are a fool for a life time. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|