Click here to Skip to main content
15,944,832 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi ,

I'm currently doing a time & attendance project. its like when i click the download button, the code and dlls communicates with the attendance reader and fetches the datas in the following format(sql) ,

empCode in/outMode  date          time
5001        0       12/09/2011    09:05:34
5002        0       12/09/2011    09:33:13
5001        1       12/09/2011    18:05:09
5002        1       12/09/2011    17:44:34

where , in the in/out mode , o is the intime and 1 is the outtime.

i want to show these datas in a single record for each employees. that is , i want to show somethng like the following , (assume that i created a new table as below) ,

empCode  date        intime      outtime
5001     12/09/2011  09:05:34    18:05:09
5002     12/09/2011  09:33:13    17:44:34

How do i do that?.. can anyone pls guide me?...
Updated 13-Sep-11 2:03am

1 solution

As you read each record store the in and out times in a structure indexed by empCode. Then when you have all the data just read through it and print in the format you want. I know that sounds obvious but maybe your question needs clarification.
Share this answer
KenBonny 13-Sep-11 9:33am    
Nice explanation. Personally I would use a class, because I like OOP, but a structure would be just as good in this case.
Richard MacCutchan 13-Sep-11 9:50am    
I agree a class would be better, but I was just trying to keep it simple. Judging by the question I would guess that the OP is something of a rookie.
arun.emm 14-Sep-11 0:44am    
yes , u r ryt.. A class would be better.. I'll work on that.. Thanks alt for ur replies..
Richard MacCutchan 14-Sep-11 3:15am    
Try not to use txtspk on these forums, it makes you look like a child/moron.

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