mainunit.cpp

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

CPP
54
字号
// 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 "MainUnit.h"
#include "DMUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TMainForm *MainForm;
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::LoadButtonClick(TObject *Sender)
{
  // Open the load picture dialog
  if (OpenPictureDialog->Execute())
  {
    // Switch to edit mode before loading the picture
    if (DM->OracleDataSet->State == dsBrowse) DM->OracleDataSet->Edit();
    DM->PICTURE->LoadFromFile(OpenPictureDialog->FileName);
    // Set the Filename field
    DM->FILENAME->Value = OpenPictureDialog->FileName;
  }
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::DropButtonClick(TObject *Sender)
{
  // Should the demo table be dropped?
  if (MessageDlg("Drop the demo table DOA_PICTUREDEMO ?", mtConfirmation,
                 TMsgDlgButtons() << mbYes << mbNo, 0) == mrYes)
  {
    // First deactivate the dataset
    DM->OracleDataSet->Active = false;
    // Then drop the table
    DM->DropTableQuery->Execute();
    // There is nothing left to do, so we terminate the program
    Application->Terminate();
  }
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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