home *** CD-ROM | disk | FTP | other *** search
- // DbSample.cpp : Defines the entry point for the console application.
- //
-
- #include "stdafx.h"
- #include "DbXmlTools.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- //====== SHOW MESSAGES ==========================================
- void ShowMsg(CStringArray &strResult)
- {
- int nMax = strResult.GetSize();
- for (int iPos=0; iPos < nMax; iPos++)
- {
- if (nMax > 1) printf("%3d: %s\n",iPos+1,strResult.GetAt(iPos));
- else printf("%s\n",strResult.GetAt(iPos));
- }
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // The one and only application object
-
- CWinApp theApp;
-
- using namespace std;
-
- int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
- {
- int nRetCode = 0;
-
- // initialize MFC and print and error on failure
- if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
- {
- // TODO: change error code to suit your needs
- cerr << _T("Fatal Error: MFC initialization failed") << endl;
- return(1);
- }
-
- //====== INITIALIZE DBXMLTOOLS INTERFACE ==========
- CDbXmlTools *pDbTkXml = new CDbXmlTools;
-
- //====== RUN SAMPLE COMMANDS ======================
- CStringArray strResult;
- CString strCmd;
- int ret_;
- do {
- strCmd.Format("opendb sample.mdb");
- ret_ = pDbTkXml->ExecCmd(strCmd,&strResult);
- ShowMsg(strResult);
- if (ret_ < 0)
- break;
-
- strCmd.Format("table Employees");
- ret_ = pDbTkXml->ExecCmd(strCmd,&strResult);
- ShowMsg(strResult);
- if (ret_ < 0)
- break;
-
- strCmd.Format("XMLExport Emp.XML");
- ret_ = pDbTkXml->ExecCmd(strCmd,&strResult);
- ShowMsg(strResult);
- } while (FALSE);
- delete pDbTkXml;
-
- return nRetCode;
- }
-
-
-
-