Update Database if Application Close unexpectedly in c# winforms -
i developing desktop based winform in c#. application may closed unexpectedly (power failure or debug mode off). in closing condition need update database . i.e. need change online status 1 0 how this?
the best way know whether application has died not try think of way update database when application closes; rather, create "session" record whenever application opened; "ping" record (i.e. there's lastpingutc column) every minute.
if application closes whatever reason, lastpingutc value on 1 minute ago , therefore can assume application / session dead.
actually, i'd assume given session dead after 5 minutes updating column may delayed.
Comments
Post a Comment