/ Published in: VB.NET
This snippet reads all user tables from a Access Database
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Private Sub ReadUserTablesFromAccess(ByVal MDBPath As String) Dim userTables As DataTable = Nothing Dim iLus As Integer Dim restrictions() As String = New String(3) {} Dim Con As OleDbConnection = New OleDbConnection() Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MDBPath & """" Else Con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & MDBPath & ";Persist Security Info=False;" End If restrictions(3) = "Table" Con.Open() userTables = Con.GetSchema("Tables", restrictions) 'Clear table list first clb_TablesToCreate.Items.Clear() For iLus = 0 To userTables.Rows.Count - 1 clb_TablesToCreate.Items.Add(userTables.Rows(iLus)(2).ToString()) Next End Sub