SOL9 Sample: AccessADOXTablesApplet

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * AccessADOXTablesApplet.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


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

#include <sol/sql/ADOXApplet.h>
#include <sol/Locale.h>

namespace SOL {

class AccessADOXTablesApplet: public ADOXApplet {

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

public:
  ~AccessADOXTablesApplet()
  {
  }

public:
  /**
   * AccessADOXTablesApplett 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");
  
      long c = tables.getCount();
      printf("Tables Count=%ld\n", c);
      printf("-->\n");

      tables.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)
{
  Locale locale; //2012/10/07

  try {
    AccessADOXTablesApplet applet(argc, argv);

    applet.start();

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


Last modified: 2 May 2016

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