Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get a list of tables in an Access (Jet) database?

I need to see if a table exists in an Access database used by my c# program. Is know there are SQL commands for other databases that will return a list of tables. Is there such a command for Access/Jet databases?

like image 514
Jon B Avatar asked May 27 '11 12:05

Jon B


People also ask

How do I get a list of tables in Access?

Click on the View tab and check System objects. If you are using Microsoft Access 2007, 2010, 2013, or 2016, right-click on the navigation pane (just above the search box) and choose Navigation Options. Then, under display options, check Show System Objects and press OK.


1 Answers

Try the GetSchema()

    connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\access.mdb";    

    connection.Open();

    DataTable userTables = connection.GetSchema("Tables");
like image 78
VAShhh Avatar answered Sep 20 '22 17:09

VAShhh