how to get table names in MS Access database [Solved]
-
Hi, What is the query to get the list of table names for MS Access. In Sql Server : USE [MyDatabase] SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES In MS Access ? Thanks in advance.
-
Hi, What is the query to get the list of table names for MS Access. In Sql Server : USE [MyDatabase] SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES In MS Access ? Thanks in advance.
-
SELECT
Table_Name = Name,
Row_Count = DCount("*",[MSysObjects].[Name])
FROM
MSysObjects
WHERE
(Left([Name],1)<>"~")
AND (Left([Name],4) <> "MSys")
AND ([Type] In (1, 4, 6))
ORDER BY
NameSource can be found here.
I are Troll :suss:
Hi Eddy, Thanks for your response. I got one more alternative for that...
OleDbConnection con = new OleDbConnection("Provider=microsoft.jet.oledb.4.0; data source="+Server.MapPath("~/App_Data/Sample.mdb"));
con.Open();
DataTable dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] {null, null, null, "TABLE"});
con.Close(); -
Hi Eddy, Thanks for your response. I got one more alternative for that...
OleDbConnection con = new OleDbConnection("Provider=microsoft.jet.oledb.4.0; data source="+Server.MapPath("~/App_Data/Sample.mdb"));
con.Open();
DataTable dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] {null, null, null, "TABLE"});
con.Close();sekhar.k wrote:
I got one more alternative for that...
The .NET version would be preferable over an SQL-statement; it's obvious what the code does if you read your version. It's not that obvious what the query on the MSys tables does. Well done :)
I are Troll :suss: