Bonjour Tout le monde
Svp .. j'ai vraiment besoin d'aide pour finir mon fichier
J'ai 3 Tables :
TBL_PAYS (PAYS_Id Type Numerique) (PAYS_Name Type Texte)
TBL_VILLE (VILLE_Id Type Numerique) (VILLE_Name Type Texte) (VILLE_Numero_Pays Type Numerique)
TBL_VILLAGE (VILLAGE_Id Type Numerique) (VILLAGE_Name Type Texte) (VILLAGE_Numero_Ville Type Numerique)
ComboBox1 est alimentee par TBL_PAYS
ComboBox2 est alimentee par TBL_VILLE
ComboBox3 est alimentee par TBL_VILLAGE
Je fais mon choix du pays avec ComboBox1 .. ma ComboBox2 sera alimentee par les villes deja choisit dans ComboBox1
Je fais mon choix du Ville avec ComboBox2 .. ma ComboBox3 sera alimentee par les villages deja choisit dans ComboBox2
Simplement avec deux ComboBox ..1 et 2 .. pays et ville .. ca fonctionne tres bien mais lorsque j'ajoute ma troisieme ComboBox3 .. des que je fais mon choix avec Combobox1 .. j'aurai ce message d'erreur (Additional information: Argument 'Expression' cannot be converted to type 'DataRowView'.).
Dans Cette ligne :
Voici tout le code du Form1 :
Code : Sélectionner tout - Visualiser dans une fenêtre à part Dim da As New OleDbDataAdapter("SELECT * From TBL_VILLAGE Where VILLAGE_Numero_Ville=" & Val(ComboBox2.SelectedValue), con)
Merci beaucoup d'avance pour l'aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Imports System.Data Imports System.Data.OleDb Public Class Form1 Dim con As New OleDbConnection Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load con = New OleDbConnection con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|Datadirectory|\CASCADING.mdb" con.Open() Dim da As New OleDbDataAdapter("SELECT * From TBL_PAYS", con) Dim ds As New DataSet da.Fill(ds, "TBL_PAYS") ComboBox1.DisplayMember = "PAYS_Name" ComboBox1.ValueMember = "PAYS_Id" ComboBox1.DataSource = ds.Tables("TBL_PAYS") ComboBox1.Refresh() End Sub Protected Sub Combobox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Dim da As New OleDbDataAdapter("SELECT * From TBL_VILLE Where VILLE_Numero_Pays=" & Val(ComboBox1.SelectedValue), con) Dim ds As New DataSet da.Fill(ds, "TBL_VILLE") ComboBox2.DataSource = ds.Tables("TBL_VILLE") ComboBox2.DisplayMember = "VILLE_Name" End Sub Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged Dim da As New OleDbDataAdapter("SELECT * From TBL_VILLAGE Where VILLAGE_Numero_Ville=" & Val(ComboBox2.SelectedValue), con) Dim ds As New DataSet da.Fill(ds, "TBL_VILLAGE") ComboBox3.DataSource = ds.Tables("TBL_VILLAGE") ComboBox3.DisplayMember = "VILLAGE_Name" End Sub End Class
Cordialement
MADA
Partager