Click here to Skip to main content
15,919,479 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have two tables Employee Details and EmpAttendance.

Employee Details has EmployeeID ,EmployeeNAME, EMailID columns.
EmpAttendance has c_Date , Eid, Intime, Outtime,Count columns.

i have a form in windows app, when we type employeeID and press Submit Button, I need to display


S.NO c_Date EmployeeID EmployeeNAME EMailID Intime Outime Count TotalWorkingHours


where TotalWorkingHours is the difference between outtime and intime.


suggest me how to do this.
Posted
Updated 20-Feb-13 23:33pm
v2

You need to start with database basics.
Do a join between the two tables and subrtact the datetimes values for intime and outtime to get totalworking hours.

Simple Database Application - Part 1[^] should help you get started.

For datetime calculations on query, try http://msdn.microsoft.com/en-us/library/ms189794.aspx[^].
 
Share this answer
 
Comments
MalwareTrojan 21-Feb-13 5:12am    
There is no Foreign Key in EmpAttendance or Matching values, so no join is possible.

--Regards Vardhan Desai
Bala Selvanayagam 21-Feb-13 5:30am    
Do we need a foreign key actually defined in order to do a join ?
MalwareTrojan 21-Feb-13 7:02am    
Not necessary but a matching column values with same datatype should be there for Join condition.
Make a Foreign Key in Table EmpAttendance with respect to EmployeeID; then do Join with matching this columns.

--Regards Vardhan Desai
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900