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 44 45 46 47 48 49
| Dim cn As New OleDbConnection
Private Sub Saisie_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cn.ConnectionString = "Provider=Microsoft.ACE.OLEDb.12.0;Data source=C:\Users\Administrator\Desktop\BD sale.accdb"
Try
cn.Open()
Dim cmd As New OleDbCommand
Dim dr As OleDbDataReader
cmd.Connection = cn
cmd = New OleDbCommand("select N_ordre from sale;", cn)
dr = cmd.ExecuteReader
While dr.Read
ComboBox1.Items.Add(dr("N_ordre"))
End While
dr.Close()
cn.Close()
Catch ex As Exception
End Try
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
cn.ConnectionString = "Provider=Microsoft.ACE.OLEDb.12.0;Data source=C:\Users\Administrator\Desktop\BD sale.accdb"
Try
cn.Open()
Dim cmd As New OleDbCommand
Dim dr As OleDbDataReader
cmd.Connection = cn
cmd = New OleDbCommand("select Sous_quartier,Cil,Quartier,Nom_Client,Avis_acces,Porte,Rue,N_compteur,N_serie,Dernier_index_lu,Tp_cal,Marque from sale where N_ordre='" + ComboBox1.SelectedItem.ToString + "';", cn)
dr = cmd.ExecuteReader
While dr.Read
TextBox1.Text = dr("Sous_quartier")
TextBox2.Text = dr("Cil")
TextBox3.Text = dr("Quartier")
TextBox4.Text = dr("Nom_Client")
TextBox5.Text = dr("Avis_acces")
TextBox6.Text = dr("Porte")
TextBox7.Text = dr("Rue")
TextBox8.Text = dr("N_compteur")
TextBox9.Text = dr("N_serie")
TextBox10.Text = dr("Dernier_index_lu")
TextBox11.Text = dr("Tp_cal")
TextBox12.Text = dr("Marque")
End While
dr.Close()
Catch ex As Exception
End Try
cn.Close() |
Partager