private void BtnTimteIn_Click(object sender, EventArgs e) { try { SqlConnection connection = new SqlConnection(myconn); connection.Open(); SqlCommand cmd = new SqlCommand("spCheckIn", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ActionType", "SaveData"); cmd.Parameters.AddWithValue("@CheckIn", (DateTime.Parse(dtpTimeIn.Text))); int NumRes = cmd.ExecuteNonQuery(); if (NumRes > 0) { MessageBox.Show("Record Saved Successfully !!!", "Register", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearAllData(); } else { MessageBox.Show("Please Try Again !!!"); } connection.Close(); } catch (Exception ex) { MessageBox.Show("Error:- " + ex.Message); } }