How to obtain the list of all tables?

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
 
J

james

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
 
G

Georges Bessis

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

Regards

Georges
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top