datamod.cpp
来自「《C Builder 5程序设计——数据库应用实务篇》程序源代码」· C++ 代码 · 共 38 行
CPP
38 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "datamod.h"
#include "errform.h"
#include "cachedup.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TCacheData *CacheData;
//---------------------------------------------------------------------------
__fastcall TCacheData::TCacheData(TComponent* Owner)
: TDataModule(Owner)
{
CacheDemoForm->SetDataSet(CacheData->CacheDS->DataSet);
}
//---------------------------------------------------------------------
// This event is triggered when an error occurs during the update process
// (such as a key violation). Here we use another form to show the user
// the error and allow them to decide what to do about it. See ErrForm.cpp
// for more information
void __fastcall TCacheData::UpdateErrorHandler(TDataSet *DataSet,
EDatabaseError *E, TUpdateKind UpdateKind,
TUpdateAction &UpdateAction)
{
UpdateAction = UpdateErrorForm->HandleError(DataSet, E, UpdateKind);
}
//---------------------------------------------------------------------
// This event displays the current update status in a calculated field
void __fastcall TCacheData::CacheQueryCalcFields(TDataSet *DataSet)
{
AnsiString UpdateStatusStr[] = {"Unmodified", "Modified", "Inserted", "Deleted"};
if (CacheQuery->CachedUpdates)
CacheQueryUpdateStatus->Value = UpdateStatusStr[CacheQuery->UpdateStatus()];
}
//---------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?