Download source files - 19 Kb
What is this?
This useful tool solves me a big problem: the ability to see what's the structure of a table in a database.
Using this software you can read structure of tables, views and system tables.
You can also list that structure into a .TXT file or print directly for a convenient use.
How to use
Since the access to the database is done via ODBC, you can read every database having only the right ODBC drivers.
Normally each database you can access, has it's own DSN (data source name) identified by an unique name: clicking on button Select DB you can see the list of defined DSN, select the one you want inspect and read all tables' structure.
If you enable Views and System Tables, you can see all views and system tables. Some databases (as ACCESS 97) don't allow you to read system tables.
Select the table (or view) in the combo and see what's inside.
You don't have the specific DSN for your database? Don't worry: select, from the DSN list, the DSN of the database engine it will automatically ask what database (often a file) to handle, and DBInfo will do the rest.
Known Bugs
I know that the code is NOT a valid example for beginner programmers... as you can see, minimal exception handling, no UNICODE support, and so on. But it's intended for programmers only; a crash isn't a problem in that case.
You can find a bug that doesn't represent a real problem: if the table has a space (or minus sign) in its name, I enclose the table name between two brackets; some database engines doesn't like this.
In that case a message will inform you about this problem.
This is the code I use:
if( sBuffer.Find(' ') != -1 ||
sBuffer.Find('-') != -1 ) {
sSQL = "SELECT * FROM [";
sSQL += sBuffer;
sSQL += "]";
} else {
sSQL = "SELECT * FROM ";
sSQL += sBuffer;
}
where sBuffer
contains the name of the table (or view).
Special Thanks
This tool was wrote after I did learn valid programming technique reading great code from George Poulose [Interactive SQL Tool (using ODBC)], Chris Maunder [Printing without the Document/View framework] and Richard Stringer [Printing Class Library] jobs.
Without their articles I would be unable to create this tool.
Thanks again guys!
That's all folks!
If you have some minutes to waste, visit my homepage.