1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
try
{
Cnx2.Open();
SqlCommand sel = new SqlCommand("sqlSelectCommand1",Cnx2);
SqlCommand req = new SqlCommand("INSERT INTO MATERIELS (ID, Nom, SN, Type, Modele, Site, Service, Date_Entree," +
"Date_Sortie, Fin_Leasing, IP, MAC, Num_Cde, Num_Immo, Num_Contrat, Date_Inventaire, Commentaires)VALUES"+
"("+TBID.Text+","+TBNom.Text+","+TBSN.Text+","+LBType.SelectedItem.ToString()+","+LBModele.SelectedItem.ToString()+""+
","+LBsite.SelectedItem.ToString()+","+LBServ.SelectedItem.ToString()+","+TBDE.Text+","+TBDS.Text+","+TBFleas.Text+""+
","+TBIP.Text+","+TBMAC.Text+","+TBCde.Text+","+TBImmo.Text+","+TBCont.Text+","+TBInv.Text+","+RTB.Text+"",Cnx2);
req.ExecuteNonQuery();
sqlDataAdapter1.Update(dsMateriel1, "MATERIELS");
Cnx2.Close();
MessageBox.Show("Materiel Inséré avec succès!");
}
catch(Exception EX)
{
MessageBox.Show(EX.Message);
}
} |
Partager