SOL9 2.0 Sample: AccessADOXViewsApplet

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * AccessADOXViewsApplet.cpp 
 * Copyright (c) 2009 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL9
// 2009/06/03
// Assume that environment of Access2007

#include <sol/sql/ADOXApplet.h>

namespace SOL {

class AccessADOXViewsApplet: public ADOXApplet {

public:
    /**
     * Constructor
     */
    AccessADOXViewsApplet(int argc, const TCHAR** argv)
        :ADOXApplet(argc, argv)
    {
    }

public:
    ~AccessADOXViewsApplet()
    {
    }

public:
    /**
     * AccessADOXViewsApplett main procedure
     */
    virtual void run()
    {
        String encoding = "";
        getXMLEncoding(encoding);

        printf("<?xml version=\"1.0\" encoding=\"%s\" ?>\n", (const TCHAR*)encoding);

        printf("<!--\n");
        printf("1 Start\n");

        ADOXCatalog& catalog = getCatalog();
        printf("2 OK, getCatalog()\n");

        printf("3 Show important connectionProperties\n");
        showConnectionProperties();
        printf("\n");

        try {
            printf("4 Try to catalog.getTables()\n");
            ADOXTables tables;
            catalog.getTables(tables);
            printf("5 OK catalog.getTables()\n");
    
            printf("6 Try to catalog.getViews()\n");

            ADOXViews  views;
            catalog.getViews(views);
            printf("7 OK catalog.getViews()\n");

            long c = views.getCount();
            printf("Views Count=%ld\n", c);
            printf("-->\n");

            views.dump();

        } catch (Exception& ex) {
            ex.dump();
        } catch (_com_error& ex) {
            COMError error(ex);
            error.dump();
        } catch (...) {
            printf("Exception: Unknown\n");
        }
    }
};

}

// Console application starts here.
void _tmain(int argc, const TCHAR** argv)
{
    try {
        AccessADOXViewsApplet applet(argc, argv);

        applet.start();

    } catch(Exception& ex){
        ex.dump();
    } catch(...){
        printf("Exception:Unknown\n");
    }
}


Last modified: 11 Nov 2009

Copyright (c) 2009 Antillia.com ALL RIGHTS RESERVED.