i am trying to build Employee Attendance system and was successful in assigning TAGS to employees.now i want to calculate in/out timings of employees and which TAG swapped His/Her TAG without displaying any data to end user. i had tried basic sql query but seems to be not working.

Please Help.

code i am using for saving and assigning Tags to employees is as follows :

SqlConnection con = new SqlConnection(str);
                SqlCommand cmd = new SqlCommand("insert into EmpTable(TagID,Firstname,Lastname,Title) values (@TagID,@Firstname,@Lastname,@Title)", con);
              //   cmd.Parameters.AddWithValue("@EmpID", txtempid.Text);
                  cmd.Parameters.AddWithValue("@TagID", txttagid.Text);
                cmd.Parameters.AddWithValue("@Firstname", txtfirstname.Text);
                cmd.Parameters.AddWithValue("@Lastname", txtlastname.Text);
                cmd.Parameters.AddWithValue("@Title", txttitle.Text);
                MessageBox.Show("Data Saved.");

So many questions.

I used bar code readers to do similar but you claim this is to be done without display to the user.

I see no sign how you would tell if they are leaving or arriving. What does you design document say about that?
(Did you design this before you wrote code?)