dmunit.cpp

来自「Direct Oracle Access 非常好的Oracle数据库直接访问组」· C++ 代码 · 共 60 行

CPP
60
字号
// Direct Oracle Access - PictureDemo
// Allround Automations
// support@allroundautomations.nl
// http://www.allroundautomations.nl
//
// This application demonstrates:
// - The use of a BLOB field in a dataset
// - The use of Data Definition Language (creating & dropping a table)
// - The use of a Data Module for the DOA components
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "DMUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Oracle"
#pragma link "OracleData"
#pragma resource "*.dfm"
TDM *DM;
//---------------------------------------------------------------------------
__fastcall TDM::TDM(TComponent* Owner)
    : TDataModule(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TDM::DataModule1Create(TObject *Sender)
{
  // Show the logon dialog
  OracleLogon->Execute();
  // If not connected then exit
  if (OracleSession->Connected)
  {
    try
    {
      // Test if the demotable exists
      CheckTableQuery->Execute();
      if (CheckTableQuery->Eof)
      {
        // If not, ask to create it
        if (MessageDlg("Create demo table DOA_PICTUREDEMO ?", mtConfirmation,
                       TMsgDlgButtons() << mbYes << mbNo, 0) == mrYes)
          CreateTableQuery->Execute();
        else
          OracleSession->Connected = false;
      }
    }
    catch (EOracleError &E)
    {
      ShowMessage(E.Message);
    }
  }
  // If everything is OK activate the dataset
  if (OracleSession->Connected)
    OracleDataSet->Active = true;
  else
    Application->Terminate();
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?