I'm creating this code to use two comboboxes, one that depends on the first, but when I'm trying to select the "code_Zone" from the Table "Zone" I have this exception:
Parameter @code1 has no default value
This is my code:
Dim cmd3 = New OleDbCommand("select [Code_Zone] from [Zone] where [Nom_Zone]= '@code';", connection)
cmd3.Parameters.AddWithValue("@code", ComboBoxNomZoneDeclaration.SelectedText.ToString)
Dim valeur = cmd3.ExecuteScalar
Dim commande = New OleDbCommand("select [Code_Cable] from [CableEnFibre] where [Code_Zone]=@code1;", connection)
commande.Parameters.AddWithValue("@code1", valeur)
Dim reader = commande.ExecuteReader 'there is the exception
While reader.Read
ComboBoxPanneCentreAppel.Items.Add(reader.GetInt32(reader.GetOrdinal("Code_Cable")))
End While
reader.Close()
Aucun commentaire:
Enregistrer un commentaire