You can execute a sql query once a day to check whether your paymentreceiveDate has expired, and if it expires, modify the status value.
How to execute sql query once a day
You need to create a job in SQL Server Agent.You can refer to this
link for specific practices.
Note: If you cannot find the SQL Server Agent, you can check this
link to solve this problem.
Best Regards,
YihuiSun
ASP.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
Member
4 Points
16 Posts
How to automatically update status after one year from given date in mvc mssql?
Jul 07, 2020 02:36 PM|sandesh pokhrel|LINK
I have database field like:
Id status paymentreceiveDate
1 paid 2020-07-07
I want update status expired after one year automatically, how can I achieve this in mvc.
All-Star
58484 Points
15810 Posts
Re: How to automatically update status after one year from given date in mvc mssql?
Jul 07, 2020 02:49 PM|bruce (sqlwork.com)|LINK
Normally you would use a sql agent job. The job could call the website if you want the logic in mvc for some reason.
Member
4 Points
16 Posts
Re: How to automatically update status after one year from given date in mvc mssql?
Jul 07, 2020 03:18 PM|sandesh pokhrel|LINK
Hello bruce can you provide any example or links given to my context?
All-Star
58484 Points
15810 Posts
Re: How to automatically update status after one year from given date in mvc mssql?
Jul 07, 2020 05:03 PM|bruce (sqlwork.com)|LINK
sql agent:
https://docs.microsoft.com/en-us/sql/ssms/agent/sql-server-agent?view=sql-server-ver15
Contributor
3090 Points
878 Posts
Re: How to automatically update status after one year from given date in mvc mssql?
Jul 09, 2020 07:58 AM|YihuiSun|LINK
Hi sandesh pokhrel,
You can execute a sql query once a day to check whether your paymentreceiveDate has expired, and if it expires, modify the status value.
Best Regards,
YihuiSun