locked
How to automatically update status after one year from given date in mvc mssql? RRS feed

  • Question

  • User140010582 posted

    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.  

    Tuesday, July 7, 2020 2:36 PM

All replies

  • User-474980206 posted

    Normally you would use a sql agent job. The job could call the website if you want the logic in mvc for some reason.

    Tuesday, July 7, 2020 2:49 PM
  • User140010582 posted

    Hello bruce can you provide any example or links given to my context?

    Tuesday, July 7, 2020 3:18 PM
  • Tuesday, July 7, 2020 5:03 PM
  • User1686398519 posted

    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.

    • 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

    Thursday, July 9, 2020 7:58 AM