1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| conn = New MySqlConnection
conn.ConnectionString = hote
req = "select nom_util from personnel where id_etat = 0"
req2 = "select count(id_p) from personnel where id_etat = 0"
contact = New MySqlCommand(req2, conn)
Try
conn.Open()
i = contact.ExecuteScalar
Dim j As Integer
contact = New MySqlCommand(req, conn)
For j = 0 To i - 1
lstcontact.Items.Add(contact.ExecuteScalar.ToString)
Next
Catch ex As Exception
MessageBox.Show(ex.ToString(), "Impossible d'établir la connexion", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
conn.Close() |