Click here to Skip to main content
13,045,417 members (85,721 online)
Click here to Skip to main content
Add your own
alternative version


36 bookmarked
Posted 26 Oct 2000

Database info tool

, 26 Oct 2000
Rate this:
Please Sign up or sign in to vote.
Explore the structure of tables (and views)
<!-- Download Links -->
  • Download source files - 19 Kb
  • <!-- Article image -->

    Sample Image - DBInfo.gif

    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:

    // add [ & ] if name contains spaces or others chars
    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.<p>


    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    About the Author

    Massimo Colurcio
    Software Developer (Senior) SOFTHOR
    Italy Italy
    Too lazy to write something about me...

    You may also be interested in...


    Comments and Discussions

    QuestionWhy... Pin
    LowFly10-Jan-12 20:19
    memberLowFly10-Jan-12 20:19 
    Generalsql error Pin
    rasha7615-Sep-04 21:36
    memberrasha7615-Sep-04 21:36 
    GeneralSQLBrowseConnection Pin
    Simone Giannecchini16-Dec-01 1:57
    memberSimone Giannecchini16-Dec-01 1:57 
    QuestionExcel tables? Pin
    Ammar17-Apr-01 2:16
    memberAmmar17-Apr-01 2:16 
    Using your app, cant use a excel dsn.

    Can you help me in getting info about Excel tables? How to get their names (if excel uses tables) or how to get data from different work sheets?

    AnswerRe: Excel tables? Pin
    Massimo Colurcio17-Apr-01 7:54
    memberMassimo Colurcio17-Apr-01 7:54 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Terms of Use | Mobile
    Web01 | 2.8.170713.1 | Last Updated 27 Oct 2000
    Article Copyright 2000 by Massimo Colurcio
    Everything else Copyright © CodeProject, 1999-2017
    Layout: fixed | fluid