1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| cnx.Open();
OleDbCommand cmdRecupnoOperation = new OleDbCommand();
cmdRecupnoOperation.Connection = cnx;
//Remet le format du cbTypeOperation au bon format
string az = cbTypeOperation.Text;
MessageBox.Show(az);
string qw = az.ToUpper();
MessageBox.Show(qw);
object NOOP = new object();
cmdRecupnoOperation.CommandText = @"select nooperation
from operations where operations.nom = '" + qw + "'";
NOOP = cmdRecupnoOperation.ExecuteScalar();
MessageBox.Show(NOOP.ToString());
OleDbCommand cmdInsertInterv = new OleDbCommand();
cmdInsertInterv.Connection = cnx;
cmdInsertInterv.CommandText = @"INSERT INTO interv (nointerv,noemp,nooperation,
noauto, observation, entree, sortie)
VALUES (SEQ_INTERV.nextval,?,?,?,?,?,?)";
//Galère pour pouvoir insérer la concaténation date + heure
DateTime date = DateTime.Parse(CalenEntree.Text);
DateTime time = DateTime.Parse(txtHeueEntree.Text, CultureInfo.InvariantCulture);
date.Add(new TimeSpan(time.Hour, time.Minute, time.Second));
DateTime date2 = DateTime.Parse(CalenSortie.Text);
DateTime time2 = DateTime.Parse(txtHeureSor.Text, CultureInfo.InvariantCulture);
date.Add(new TimeSpan(time.Hour, time.Minute, time.Second));
//Les paramètres des différentes cmdInsertInterv
cmdInsertInterv.Parameters.Add(new OleDbParameter("@NOEMP", cbNoEmp.Text));
cmdInsertInterv.Parameters.Add(new OleDbParameter("@NOOPERATION", NOOP ));
cmdInsertInterv.Parameters.Add(new OleDbParameter("@NOAUTO", cbNoAuto.Text));
cmdInsertInterv.Parameters.Add(new OleDbParameter("@OBSERVATION", txtObserv.Text));
cmdInsertInterv.Parameters.Add(new OleDbParameter("@ENTREE", time));
cmdInsertInterv.Parameters.Add(new OleDbParameter("@SORTIE", time2));
cmdInsertInterv.ExecuteNonQuery();
cnx.Close(); |
Partager