Raghuveera
Raghuveera

Reputation: 320

How to select All the Tables in Access DataBase 2007 using query

I am working in C#.net.I want to select all table names in the Access Database using Query. Can any one tell... How to select all the tables name from access database using query?.

Upvotes: 0

Views: 1085

Answers (1)

Pandian
Pandian

Reputation: 9126

Try like below it will help you...

string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\myAccess2007file.accdb;Persist Security Info=False;";
OleDbConnection conn = new OleDbConnection(connectionString);
conn.Open();
DataTable tables = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[]{null,null,null,"TABLE"});
conn.Close();

Now the Datatable "tables" have all the access table Info..

Upvotes: 1

Related Questions