vb.net - asp.net vb - update database field value automatically when another value is added elsewhere -
i have 2 tables: holidayrequests & holidayentitlement
within holiday requests have 1 field:
- days
when staff member adds holiday request stored number in holiday requests table in days field (there multiple requests different days)
within holidayentitlement table have 3 fields:
- entitlement
- taken
- remaining
when staff member adds holiday request want update both taken , remaining like...
taken = (sum)days staffid = staffid
remaining = entitlement - taken
i've got no idea how go doing this. idea similar of stock management... can point me in right direction can started
you can implement business logic that:
- in database triggers (see other answers)
- in vb code linq2sql using partial methods:
example http://msdn.microsoft.com/en-us/library/bb546176.aspx
partial class customer private sub onaddresschanged() ' insert business logic here. end sub end class
Comments
Post a Comment