📄 mainform.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "MainForm.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnPostError(TDataSet *DataSet, EDatabaseError *E,
TDataAction &Action)
{
if(dynamic_cast<EDBEngineError*>(E)->Errors[0]->ErrorCode==9729)
{
MessageBox(NULL,"主键重复,不能执行!","信息提示",MB_OK);
return;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnDeleteError(TDataSet *DataSet, EDatabaseError *E,
TDataAction &Action)
{
if(dynamic_cast<EDBEngineError*>(E)->Errors[0]->ErrorCode==9734)
{
MessageBox(NULL,"不能修改或删除一对多关联的主数据表记录!","信息提示",MB_OK);
return;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnUpdateError(TDataSet *DataSet, EDatabaseError *E,
TUpdateKind UpdateKind, TUpdateAction &UpdateAction)
{
if(dynamic_cast<EDBEngineError*>(E)->Errors[0]->ErrorCode==9734)
{
MessageBox(NULL,"不能修改或删除一对多关联的主数据表记录!","信息提示",MB_OK);
return;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnEditError(TDataSet *DataSet, EDatabaseError *E,
TDataAction &Action)
{
int iDBIError=dynamic_cast<EDBEngineError*>(E)->Errors[0]->ErrorCode;
switch(iDBIError)
{
case 9731:
MessageBox(NULL,"大于列的最大值限制!","信息提示",MB_OK);
return;
case 9732:
MessageBox(NULL,"主键一定要输入!","信息提示",MB_OK);
return;
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -