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

Jon B picture Jon B · May 27, 2011 · Viewed 18.7k times · Source

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?

Answer

VAShhh picture VAShhh · May 27, 2011

Try the GetSchema()

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

    connection.Open();

    DataTable userTables = connection.GetSchema("Tables");