1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
try
{
OleDbConnection connection = new OleDbConnection(@"provider=microsoft.jet.Oledb.4.0;data source=Library.mdb");
OleDbCommand commande = new OleDbCommand();
connection.Open();
commande.Connection = connection;
commande.CommandText =string.Format( @"INSERT INTO clients(nom,prenom,classe,categoriedulivre,titredulivre,numerodeversion,date) VALUES({0} ,{1},{2},{3},{4},{5},{6});", textBox1.Text,textBox2.Text ,textBox3.Text ,comboBox1.Text ,textBox4.Text ,int.Parse(textBox6.Text) ,DateTime.Now );
commande.ExecuteNonQuery();
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} |
Partager