OleDbConnection cn = DataBase.CreaConnessione(); OleDbDataAdapter ad = new OleDbDataAdapter(); Operai o = new Operai(); DateTime entrata; DateTime uscita; TimeSpan tmp; private void Form2_Load(object sender, EventArgs e) { } private void btnentrata_Click(object sender, EventArgs e) { entrata = DateTime.Now; txtentrata.Text = entrata.ToLongTimeString(); OleDbCommand cmd = cn.CreateCommand(); cmd.CommandText = "INSERT INTO operai (cognome,nome,entrata) VALUES ('" + this.txtcognome.Text + "','" + this.txtnome.Text + "','" + this.txtentrata.Text + "')"; cmd.CommandType = CommandType.Text; cn.Open(); cmd.ExecuteNonQuery(); cn.Close(); } private void btuscita_Click(object sender, EventArgs e) { uscita = DateTime.Now; txtuscita.Text = uscita.ToLongTimeString(); OleDbCommand cmd = cn.CreateCommand(); cmd.CommandText = "INSERT INTO operai (cognome,nome,uscita) VALUES ('" + this.txtcognome.Text + "','" + this.txtnome.Text + "','" + this.txtuscita.Text + "')"; cmd.CommandType = CommandType.Text; cn.Open(); cmd.ExecuteNonQuery();