[ADO.NET][VB.Net]Comment réaliser jointure de 2 DataTables ?
Hello,
JE voudrais réaliser une jointure de deux Datatables pour afficher ces données dans une Grid. j'y arrive avec le code suivant, mais j'ai des problème de performances assez vite ( +- 2500 records ).
Code:
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
|
' Create DataViews for the Categories and Products tables.
Dim catView As DataView = New DataView(myDS.TabEtud, "", "Nom", DataViewRowState.CurrentRows)
Dim ProdView As DataView
' Iterate through the Categories table.
Dim catDRV, prodDRV As DataRowView
For Each catDRV In catView
'Console.WriteLine(catDRV("Nom"))
' Create a DataView of the child product records.
ProdView = catDRV.CreateChildView(myDS.Relations("FK_TabEtud_TabCour"))
ProdView.Sort = "brol"
For Each prodDRV In ProdView
'Console.WriteLine(vbTab & prodDRV("brol"))
Dim rowView As testDataSet.ViewRelationRow = myDS.ViewRelation.NewRow
rowView.idEtud = catDRV("idEtud")
rowView.Nom = catDRV("nom")
rowView.Prenom = catDRV("prenom")
rowView.brol = prodDRV("brol")
myDS.ViewRelation.AddViewRelationRow(rowView)
Next
Next
DataGridView1.DataSource = myDS.ViewRelation |
Est ce que quelqu'un aurait une autre solution, ou un moyen pour améliorer les performances ??
Merci