Question Creating a punch clock?

jhiggy

New member
Joined
Sep 10, 2009
Messages
3
Programming Experience
Beginner
Hello! I am attempting to create a punch clock for my business and I am running into a little bit of a problem that I was hoping to get a little help with.
What do you believe is the best way to have the program find the same row it created for a "Punch-In" for a single user. To clear this up what I have is a data table with the columns: Employee Num, Date, TimeIn, Timeout, Lunchout, Lunchin. And what I want it to do is when you first punch in, create a row for the specific user, then find that row later on and continue filling out what they do next. (make sense?) I don't have a ton of the sql + vb experience and I am having trouble figuring out a way to do this. Thank you ahead of time for any bit of help you are able to send my way. (websites anything!!) I am about ready to pull my already thinning hair out!!!

Thanks again,

-Jeffrey

P.S. I am using VS 2008 + SQL Server express 2008
 

rcombs4

Well-known member
Joined
Aug 6, 2008
Messages
189
Programming Experience
3-5
You would need to do a sub query.

For a 'Lunch out'
VB.NET:
UPDATE --TableName-- SET LunchOut = GetDate() WHERE ID = (SELECT ID FROM --TableName-- WHERE EmployeeNum = @EmployeeNum AND TimeOUT IS NULL)

The sub query will give you the ID of the row where the currently employee has clocked in but has yet to clock out. You can't really take a lunch after you have already clocked out.
 

jhiggy

New member
Joined
Sep 10, 2009
Messages
3
Programming Experience
Beginner
You are my hero!!! thank you, I can't tell you how long I've been working to figure that out.

Thanks!

p.s. Whats the @ symbol indicate?
 
Top Bottom