person_assistant.cpp

来自「用C++写的人事管理系统」· C++ 代码 · 共 40 行

CPP
40
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Person_Assistant.h"
#include "Person.h"      //添加主窗体头文件
#include "Person_Info.h" //员工资料窗口头文件
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TF_Assis *F_Assis;
//---------------------------------------------------------------------------
__fastcall TF_Assis::TF_Assis(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TF_Assis::BitBtn1Click(TObject *Sender)
{   /*****添加按钮点击事件******/
    int count_ID;               //定义辅助资料数据表记录号变量
    count_ID = ADOT_Count->FieldByName("Count_Value")->AsInteger; //取得course记录号的值
    count_ID+=1;      //记录号加1
    if(!Edit1->Text.IsEmpty()){ //输入内容为空判断
      DBLookupListBox1->ListSource->DataSet->Insert(); //插入一条辅助信息记录
      DBLookupListBox1->ListSource->DataSet->FieldByName(DBLookupListBox1->KeyField)->AsInteger = count_ID; //选课信息记录号
      DBLookupListBox1->ListSource->DataSet->FieldByName(DBLookupListBox1->ListField)->AsString = Edit1->Text;
      DBLookupListBox1->ListSource->DataSet->Post();   //执行插入操作
      ADOT_Count->Edit();   //设置计数表为可编辑
      ADOT_Count->FieldByName("Count_Value")->AsInteger = count_ID;   //加1后的记录号存入计数数据表
      ADOT_Count->Post();   //执行编辑操作
      }
}
//---------------------------------------------------------------------------
void __fastcall TF_Assis::BitBtn2Click(TObject *Sender)
{     /*****删除按钮点击事件******/
    DBLookupListBox1->ListSource->DataSet->Delete(); //删除选中的记录
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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