private void conf_bt_Click(object sender, EventArgs e)
        {
            Connexion       c  = new Connexion();
            OleDbConnection cn = c.connect();

            cn.Open();
            PassagerADO pass = new PassagerADO();

            pass.modifier(cn, txt_cin.Text, txt_nom.Text, txt_adr.Text, txt_telephone.Text, txt_email.Text);
        }
        private void ok_bt_Click(object sender, EventArgs e)
        {
            Connexion       c  = new Connexion();
            OleDbConnection cn = c.connect();

            cn.Open();
            PassagerADO pass = new PassagerADO();
            DataTable   dt   = pass.recherche(txt_rech_pass.Text, cn);

            dataGridView1.DataSource = dt;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Connexion       c  = new Connexion();
            OleDbConnection cn = c.connect();

            cn.Open();
            PassagerADO ps = new PassagerADO();

            ps.supprimer_passager(selected_row, cn);
            dataGridView1.Rows.Remove(selected_row);
        }
        private void frm_liste_passagers_Load(object sender, EventArgs e)
        {
            Connexion       c   = new Connexion();
            OleDbConnection con = c.connect();

            con.Open();
            PassagerADO vol = new PassagerADO();
            DataTable   dt  = vol.liste_passager(con);

            dataGridView1.DataSource = dt;
        }
示例#5
0
        private void button1_Click(object sender, EventArgs e)
        {
            /*string connetionString = null;
             * OleDbConnection connection;
             * OleDbCommand command;
             * string sql = "INSERT INTO passager (`num_pass`,`nomprenom_pass`,`adr_pass`,`tel_pass`,`email_pass`)VALUES('234','34','234','324','234')";
             *
             * connetionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\kamel\Documents\as.mdb";
             * // sql = "Your SQL Statemnt Here";
             *
             * connection = new OleDbConnection(connetionString);
             * try
             * {
             *  connection.Open();
             * //  command = new OleDbCommand(sql, connection);
             *    command = new OleDbCommand("SELECT * FROM passager", connection);
             *  OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM passager", connection);
             *  DataTable t = new DataTable();
             *  da.Fill(t);
             *    //OleDbDataReader dr; dr = command.ExecuteReader();
             *    dataGridView1.DataSource = t;
             *
             *
             * // command.ExecuteNonQuery();
             *  //command.Dispose();
             *  connection.Close();
             *  MessageBox.Show(" ExecuteNonQuery in SqlCommand executed !!");
             * }
             * catch (Exception ex)
             * {
             *  MessageBox.Show("Can not open connection ! "+ex.Message);
             * }
             *
             */

            Connexion       c   = new Connexion();
            OleDbConnection con = c.connect();

            con.Open();

            Passager p = new Passager(Int32.Parse(txt_pass_cin.Text), txt_pass_nom.Text, txt_pass_email.Text, Int32.Parse(txt_pass_tel.Text), txt_pass_adr.Text);

            PassagerADO pass = new PassagerADO();

            pass.ajouter_passager(p, con);
        }