Sometimes we need to see what Tables and their Column definitions are in an Access (.mdb) Database. This demonstration program will allow you to select any Access .mdb Database file on your computer and will show a list of Table and Column definitions.
A Visual Studio 2010 demonstration project for Schema Info is available for your use.
Two Structures were created to define the Tables and Columns. There is one sSchemaTable structure element for each table in the database, and one sSchemaColumn structure for each Column in the table.
- Structure sSchemaTable
Element Type Description TableName String Name of Table scs() sSchemaColumn Structure Array - One element for each Column in Table - Structure sSchemaColumn
Element Type Description ColumnName String Name of Column ColumnSize Integer Size of Column ColumnType String Data Type of Column, ie; Integer, string, etc.
Program Properties and Routines:
Property/Routine | Parameters | Returns | Description |
---|---|---|---|
TableInfo | _TableName | sSchemaTable | Information for a Table |
ColumnInfo | _Column _TableName |
sSchemaColumn | Information for a Table Column |
ColumnLength | _Column _TableName |
Integer | Maximum Length of a Column |
GetSchema | _TableNames _connDb |
Get the Column Definitions for all Tables listed in the _TableNames string array using the _connDB database connection. |
The follow is a demonstration program to list an Access Database's Tables and Columns.
- Create a new Windows Form Application Project with Visual Studio.
- Create a ListView on the default Form1.
- Use the follow code for Form1.
- Execute the program and select the Access Database file you what to list.