Liaison dynamique entre deux combobox charger depuit une base de donnée access

sonsonme Messages postés 2 Date d'inscription lundi 9 mai 2011 Statut Membre Dernière intervention 18 mai 2012 - 18 mai 2012 à 02:42
sonsonme Messages postés 2 Date d'inscription lundi 9 mai 2011 Statut Membre Dernière intervention 18 mai 2012 - 18 mai 2012 à 02:46
bonjour,
je cherche a remplir un combobox2 crée d'une façon dynamique a partir d'une base de données.
sa création dépend de la valeur sélectionnée depuis un autre combobox1 crée aussi d'une façon dynamique.
j'arrive pas a récupérer la valeur du combobox1 .
erreur"Erreur de syntaxe (opérateur absent) dans l'expression « UAP = »"
voici mon code:
Dim mycon As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=xxxxxx\Basededonnées.accdb"
Dim myRe As OleDbDataReader
Dim con11 As New OleDb.OleDbConnection(mycon)


' Dim jj = CType(comboboxp.SelectedItem, String)
Dim comCustomer88 As New OleDb.OleDbCommand("select ref from produits where UAP = " & comboboxp.Text & "", con11)
combobob.Items.Clear()
combobob.Text = ""
con11.Open()
comCustomer88.ExecuteNonQuery()
myRe = comCustomer88.ExecuteReader()
If myRe.HasRows Then
While myRe.Read()
combobob.Items.Add(myRe.Item("ref"))
End While
myRe.Close()
comCustomer88.Dispose()
con11.Close()
Else
myRe.Close()
comCustomer88.Dispose()
con11.Close()
End If

En ésperant avoir été clair merci d'avance de votre aide.
Cordialement

1 réponse

sonsonme Messages postés 2 Date d'inscription lundi 9 mai 2011 Statut Membre Dernière intervention 18 mai 2012
18 mai 2012 à 02:46
bonjour,
voici le code d'ajout dynamique
Dim h As Boolean
h = True
If h = True Then
Dim size As SizeF = comboboxp.CreateGraphics.MeasureString("", comboboxp.Font)
comboboxp.Font = New System.Drawing.Font("Modern No. 20", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
comboboxp.FormattingEnabled = True
comboboxp.Size = New System.Drawing.Size(55, 25)
comboboxp.Location = New Point(position, position2)
Me.Controls.Add(comboboxp)
h = False
'---------------ComboBox2-------------------------
Dim combobo As New ComboBox
Dim siz As SizeF = combobo.CreateGraphics.MeasureString("", combobo.Font)
combobo.Font = New System.Drawing.Font("Modern No. 20", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
combobo.FormattingEnabled = True
combobo.Size = New System.Drawing.Size(111, 25)
combobo.Location = New Point(positio, positio2)
Me.Controls.Add(combobo)
h = False
uap(comboboxp)
AddHandler comboboxp.SelectedIndexChanged, AddressOf ComboBox_SelectedIndexChanged
'""le code de cet évènement est celui du premier message ajouté""'
End If
position += 0
position2 += 35
positio += 0
positio2 += 35
0
Rejoignez-nous