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
|
private void liste_Load(object sender, EventArgs e)
{
try
{
timer_reload.Enabled = true;
// Connexion à la base de données
string connexion = "Server=IP;Port=3306;Database=db_commande;Uid=PSEUDO;Pwd=MDP;";
maconnexion = new MySqlConnection(connexion);
maconnexion.Open(); // Ouverture
MySqlDataAdapter adapter_commande_attente = new MySqlDataAdapter("SELECT co_ref, co_fich, co_dat, co_qte, co_del, co_com, co_sta, co_fac, co_imp, for_nom, gra_nom, pro_nom FROM commande,forma,grammage,produit WHERE co_for=for_id AND co_gra=gra_id AND co_pro=pro_id AND co_sta=0 ORDER BY co_dat DESC", maconnexion);
MySqlDataAdapter adapter_commande_termine = new MySqlDataAdapter("SELECT co_ref, co_fich, co_dat, co_qte, co_del, co_com, co_sta, co_fac, co_imp, for_nom, gra_nom, pro_nom FROM commande,forma,grammage,produit WHERE co_for=for_id AND co_gra=gra_id AND co_pro=pro_id AND co_sta=1 ORDER BY co_dat ASC LIMIT 10", maconnexion);
MySqlCommandBuilder builder = new MySqlCommandBuilder(adapter_commande_attente);
adapter_commande_attente.Fill(dataset_commande, "commande_attente");
adapter_commande_termine.Fill(dataset_commande, "commande_termine");
DataView MonDataView = dataset_commande.Tables["commande_attente"].DefaultView;
dataGridView_attente.DataSource = MonDataView;
DataView MonDataView2 = dataset_commande.Tables["commande_termine"].DefaultView;
dataGridView_termine.DataSource = MonDataView2;
}
catch (Exception)
{
MessageBox.Show("Connexion impossible avec le serveur, veuillez vérifier son état !", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} |
Partager