开发者

SQL Stored Procedures To Run Automatically

I have an asp.NET framework 4 web form website with user login capabilities etc etc... Im using visual studio 2010.

Each user has 3 login attempts once the log in attempts has passed 3, their account is locked. The only way to unlock t开发者_开发问答hese accounts is via the admin panel.

however a need a stored procedure or trigger that sets all the login attempts to zero each day. This way the login attempts wont be accumulative, just a daily counter.

How would this be done?


If you storing login attempts count in any table for each user then you can create one job which runs every day and make attempt count to 0 for each user.

If you have no idea about how to create job then please refer this link :

Job in SQL 2005

Job in SQL 2000


You can use the SQL Server Agent to schedule a job.

http://msdn.microsoft.com/en-us/library/ms189089.aspx

Add a step that simply sets the login attempts field to 0 for every user, and schedule it to run daily.


If you have control over your SQL Server, then have a look at running a SQL Agent Job or writing a Windows Service.

If you are outsourced to Azure, you can wrap your SProc in a Service call and use the Task Scheduler Service.

Also, look here and here


As the other answers say, you can create a job for SQL Server Agent, and have it execute once a day.

However, I generally distrust this kind of solution - if the Agent job fails for some reason, you could end up locking people out of the application and never know about it.

I'd recommend storing the attempts in a "login_attempts" table, with a time stamp, and writing your query to filter out attempts older than 24 hours.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜