Method 1: perform special processing on database files:
Open Database Files
Tools> options
Then set both the system object and the hidden object:
Then you will see the system table:
The msysobjects table is similar to the system table in sqlserver, which records all user tables, views, and other information. You just need to query it.
SQL statement: "select [name] as [table_name], [flags], [type] from [msysobjects] Where [flags] = 0 and [type] = 1 ";
However, by default, your applicationProgramYou do not have the permission to read this table (yes, you do not have the permission to read this table ).
Therefore, before reading this table, you must set the permissions:
Tools> Security> user and group permissions
Just remove the read permission.
However, we cannot guarantee that all data files have the read permission on msysobjects, And it is troublesome to set it every time.
Method 2:
Use oledb system APIs to solve this problem. Of course, oledbconnection of. net has been encapsulated for us.
Datatable schematable = conn. getoledbschematable (oledbschemaguid. Tables, new object [] {null, "table "});
You can do it with just one sentence. Of course, the view can be read in the same way. For more information, see msdn.