How to obtain the list of all tables?

  • Thread starter Thread starter Georges Bessis
  • Start date Start date
G

Georges Bessis

Easy in DAO but can't find a way with ADO.Net :

How to obtain the list of all tables (names) of an Access Database in
VB.Net?

Thanks in advance.

GB
 
Georges Bessis said:
Easy in DAO but can't find a way with ADO.Net :

How to obtain the list of all tables (names) of an Access Database in VB.Net?

Thanks in advance.

GB


Something like this:

Dim mytbl As String
' Open the connection.

accessConnection.Open()

'Get how many tables this datafile has

Dim schemaTable As DataTable = accessConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing,
Nothing, "TABLE"})

'get the table name

Dim i As Integer = 0

Dim r As DataRow

For Each r In schemaTable.Rows

mytbl = r("TABLE_NAME").ToString()

Listbox1.Items.Add(mytbl).ToString

Next r

*************************

This is the easist way I have found to get Table Names.

james
 
Thanks a lot. This s exacly what I was looking for. It works perferct for
me.

Regards

Georges
 
Back
Top