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
|
try
{
cnn.Open();
DbTransaction trans = cnn.BeginTransaction();
DbCommand cmm = cnn.CreateCommand();
cmm.Transaction = trans;
cmm.CommandText = "SELECT Lieu FROM T_Saut";
using (DbDataReader rs = cmm.ExecuteReader())
{
while (rs.Read())
{
// listBox2.Text += rs.AddItem.ToString() + "\r\n"; // j'ai essayé ces 2 méthodes mais rien ne marche...
listBox1.DisplayMember = "Lieu";
}
}
cmm.ExecuteNonQuery();
trans.Commit();
cnn.Close();
// fermeture de la fenêtre
DialogResult exitConfirm1 = (MessageBox.Show("affichage ok", "Test", MessageBoxButtons.OK));
this.Close();
}
catch (Exception exception)
{
Console.WriteLine("Exception occured");
} |
Partager