There are a lot of little things one has to do to complete any project. Exporting files, tweaking data, documenting things, coming up with graphics are just some of the skills developers need. Technical books projects are a lot like software projects. There are a little of extra little computer skills, sometimes basic but useful, that have to be managed to get a finished product. One of the samples in the book project—Professional DevExpress ASP.NET Controls—uses an Access database. It was useful to describe the schema of the Access for the Access tables because they were to mapped to another implicit schema. The odd challenge was that there didn’t seem to be an analog for querying the schema of Access tables in Access. You can show hidden objects and query tables like MSysAccessObjects, which will give you some information, but it doesn’t appear that you can query schema tables like you can in SQL Server. (Perhaps one of you knows how to do this and can enlighten me.)
You can of course write code to load a table and dump table and field names, data types, and sizes, and you can use the tools in MS Access to create schema reports. The following numbered steps describe how to create a report for the Cars and CarScheduling tables in Developer Express’ CarsDB.mdb database. You can of course substitute any Access database and tables, if you’d like. To print database documentation follow these steps:
- Open MS Access and open your database. (For this sample the CarsDB.MDB sample database installed with ASPxperience was used)
- Press ALT+T+Y+D to open the Documentor. (This is a legacy menu option that still works as long as you know the shortcut)
- Click the Table tabs
- In the Documentor Table tab check the Cars and CarScheduling tables (see Figure 1)
- Click the Options button
- In the Include for Table group check Properties only
- In the Include for Fields group select the Names, Data Types, and Sizes radio button
- In the Include for Indexes group select the Nothing radio button (see Figure 2).
- Click OK to close the Print Table Definition dialog
- Click OK to generate the documentation
- When the documentation report is finished the Print Preview tab will be displayed. Click Text File in the Data section to export the report to a text file
- In the Export – Text File dialog (see Figure 3)
- Check open the destination file after the export operation is complete
- Click OK
- For the encoding choose Windows default
The export documentation is provided in Listing 1. That’s all there is to it.
Figure 1: The Documentor in MS Access.
Figure 2: The Print Table Definitions dialog lets you choose what you want to print.
Figure 3: Export the printed result to a text file and open the results.
Listing 1: The exported text content based on the options selected.
C:\Websites\SchedulerDemo\App_Data\CarsDB.mdb Friday, July 03, 2009
Table: Cars Page: 1
Properties
DateCreated: 7/16/2002 5:48:37 PM DefaultView: 2
GUID: {guid {8EECDB13- LastUpdated: 7/4/2006 12:02:46 PM
A77D-45D5-84D5-
NameMap: Long binary data OrderByOn: False
Orientation: Left-to-Right RecordCount: 15
Updatable: True
Columns
Name Type Size
ID Long Integer 4
Trademark Text 50
Model Text 50
HP Integer 2
Liter Double 8
Cyl Byte 1
TransmissSpeedCount Byte 1
TransmissAutomatic Text 3
MPG_City Byte 1
MPG_Highway Byte 1
Category Text 7
Description Memo -
Hyperlink Text 50
Picture OLE Object -
Price Currency 8
RtfContent Memo -
C:\Websites\SchedulerDemo\App_Data\CarsDB.mdb Friday, July 03, 2009
Table: CarScheduling Page: 2
Properties
DateCreated: 7/15/2005 5:09:08 PM DefaultView: 2
GUID: {guid {26F80294-9FDD- LastUpdated: 11/1/2007 1:31:56 PM
4A29-8A9C-
NameMap: Long binary data OrderByOn: True
Orientation: Left-to-Right RecordCount: 20
RowHeight: 1425 Updatable: True
Columns
Name Type Size
ID Long Integer 4
CarId Long Integer 4
UserId Long Integer 4
Status Long Integer 4
Subject Text 50
Description Memo -
Label Long Integer 4
StartTime Date/Time 8
EndTime Date/Time 8
Location Text 50
AllDay Yes/No 1
EventType Long Integer 4
RecurrenceInfo Memo -
ReminderInfo Memo -
Price Currency 8
ContactInfo Memo -