1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Private Sub NomDeTaFenêtre_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
req = "SELECT LeChampQueTuVeux FROM LaTableCorrespondante"
Dim cnx As MySqlConnection
cnx = New MySqlConnection("Database=NomDeTaBase;Data Source=LieuDeTaBase;User Id=TonLogin;Password="TonMDP"")
cnx.Open()
Dim cmd As MySqlCommand
cmd = cnx.CreateCommand()
cmd.CommandText = req
Dim dr As MySqlDataReader
dr = cmd.ExecuteReader()
Do While dr.Read()
NomDeTaCombobox.Items.Add(dr.GetString(0))
Loop
cnx.Close()
End Sub |
Partager