📄 mainunit.cpp
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -