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 32 33 34 35 36 37 38 39 40 41 42 43
| public partial class Reparer : Form
{
public static MySqlConnection obj;
public Reparer()
{
InitializeComponent();
}
void ReparerLoad(object sender, EventArgs e)
{
//ouverture base de donnee
string chcnx="database=voiture; Data Source=localhost;User id=root;Password=";
obj=new MySqlConnection(chcnx);
obj.Open();
MySqlCommand cmdSelect=MainForm.obj.CreateCommand();
cmdSelect.CommandText="select * from reparation";
MySqlDataReader resultat=cmdSelect.ExecuteReader();
while (resultat.Read())
{
domainUpDown1.Items.Add(resultat.GetValue(1));
}
resultat.Close();
MySqlCommand cmd1Select=MainForm.obj.CreateCommand();
cmd1Select.CommandText="select motif_reparation from reparation";
MySqlDataReader resultat1=cmd1Select.ExecuteReader();
while (resultat1.Read())
{
listBox1.Items.Add(resultat1.GetValue(1));
}
resultat.Close();
MySqlCommand cmd2Select=MainForm.obj.CreateCommand();
cmd2Select.CommandText="select piece from reparation";
MySqlDataReader resultat2=cmd2Select.ExecuteReader();
while (resultat2.Read())
{
listBox2.Items.Add(resultat2.GetValue(2));
}
resultat.Close(); |
Partager