Ejemplo n.º 1
0
        public void ajouter()
        {
            int cmv_code = 1;

            try
            {
                if (dgvCommVente.Rows.Count != 0)
                {
                    string          MyConString = "SERVER=localhost;" + "DATABASE=gestioncommerciale;" + "UID=root;" + "PASSWORD=freedomity;";
                    MySqlConnection connection  = new MySqlConnection(MyConString);
                    MySqlCommand    cmd         = connection.CreateCommand();
                    cmd.CommandText = "select max(cmv_code) from commandevente";
                    connection.Open();
                    cmv_code = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
                    connection.Close();
                }
                Form acv = new AjouterCommandeVente(Convert.ToString(cmv_code), this);
                acv.Show();
                ac.Enabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
 public void ajouter()
 {
     int cmv_code = 1;
     try
     {
         if (dgvCommVente.Rows.Count != 0)
         {
             string MyConString = "SERVER=localhost;" + "DATABASE=gestioncommerciale;" + "UID=root;" + "PASSWORD=freedomity;";
             MySqlConnection connection = new MySqlConnection(MyConString);
             MySqlCommand cmd = connection.CreateCommand();
             cmd.CommandText = "select max(cmv_code) from commandevente";
             connection.Open();
             cmv_code = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
             connection.Close();
         }
         Form acv = new AjouterCommandeVente(Convert.ToString(cmv_code),this);
         acv.Show();
         ac.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
     }
 }