Datatable in array ??

  • VB.NET

    Datatable in array ??

    Hallo zusammen,

    ich habe in meinem Array 30 Tabellennamen und möchte für jedes ein Dataset erstellen, damit ich es in dem jeweiligen Datagridview anzeigen kann. Besteht die möglichkeit???

    Hier der Code, den ich bis jetzt habe!

    VB.NET-Quellcode

    1. Private dt() As DataTable
    2. Private da() As OleDbDataAdapter
    3. Private ds() As DataSet
    4. Private bs() As BindingSource
    5. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    6. Dim ConStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Desktop\VB\Kopie von Erwärmungsmessung_V1.3\Labormessungen.mdb;"
    7. Dim Con As New OleDbConnection(ConStr)
    8. ReadAllMDBTables(ConStr)
    9. Dim i As Integeri = oTables.Count ' Anzahl der Tabellen
    10. For schleife As Integer = 1 To i
    11. ds(schleife).Tables.Add(dt(schleife))
    12. da(schleife) = New OleDbDataAdapter("SELECT * FROM " & oTables(i - 1), Con)
    13. da(schleife).Fill(dt(schleife))
    14. Dim cb As New OleDbCommandBuilder(da(schleife))
    15. bs(schleife).DataSource = dt
    16. Dim mycontrols() As Control
    17. mycontrols = Controls.Find("DataGridView" & schleife, True)
    18. Dim dgv As DataGridView = CType(mycontrols(0), DataGridView)
    19. dgv.DataSource = bsNext
    20. End Sub




    Danke!