I am using C#,Asp.net and MS sql to develop my web application.
I have a table with 3 columns
Employeetbl
empid primary key
datefrom
dateto
in gridview i display empid,datefrom,dateto, years.
years is a column in the gridview to display year differenct between the two dates.
now i have an other table called Leavetbl which has leaveid, empid,totalleave
empid is foreign key referencing employeetbl.
now i want to insert totalleave for each employee automatically.
if the year difference is 1, leave=14
if year difference is 2=totalleave=>14+15=29
if year difference is 3=>totalleave=14+15+16=45
if year difference is 4=>totalleave=14+15+16+17=62
if year difference is 5=>totalleave=14+15+16+17+18=80
as year difference goes on, totalleave will be sum of previous years plus the new incremented one
so how can i do this? help me please


Reply With Quote
