You should read the chkInOut record from the database by the key (Name?) and only create a new
CheckInCheckOut object when it fails. You're code could look like:
CheckInCheckOut chkInOut = db.CheckInCheckOuts.GetChange(txtName.Text);
if (chkInOut != null)
{
chkInOut.CheckOutTime = DateTime.Now;
}
else
{
chkInOut = new CheckInCheckOut();
chkInOut.CheckOutTime = DateTime.Now;
chkInOut.Name = txtName.Text;
db.CheckInCheckOuts.InsertOnSubmit(chkInOut);
}
db.SubmitChanges();
Regards
Piet