⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xiaopiao.cpp

📁 一个基于MFC的编程的图书管理系统
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "xiaopiao.h"
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_xiaopiao *fm_xiaopiao;
//---------------------------------------------------------------------------
__fastcall Tfm_xiaopiao::Tfm_xiaopiao(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall Tfm_xiaopiao::FormShow(TObject *Sender)
{
    Left=100;
    Top=100;
    dm_data->ds_xiaopiao->Close();
    dm_data->ds_xiaopiao->Open();
    dm_data->ds_xiaopiao->Edit();

    dm_data->ds_guest->Close();
    dm_data->ds_guest->CommandText="select * from code where id=20000";
    dm_data->ds_guest->Open();
    piaotou->Text=dm_data->ds_guest->FieldByName("content")->AsString;
    dm_data->ds_guest->Close();
}
//---------------------------------------------------------------------------

void __fastcall Tfm_xiaopiao::FormClose(TObject *Sender,
      TCloseAction &Action)
{
    dm_data->ds_xiaopiao->Edit();
    dm_data->ds_xiaopiao->Post();
    dm_data->ds_xiaopiao->Close();

    dm_data->ds_guest->Close();
    dm_data->ds_guest->CommandText="select * from code where id=20000";
    dm_data->ds_guest->Open();
    dm_data->ds_guest->Edit();
    dm_data->ds_guest->FieldByName("content")->AsString=piaotou->Text;
    dm_data->ds_guest->Post();
    dm_data->ds_guest->Close();

}
//---------------------------------------------------------------------------

void __fastcall Tfm_xiaopiao::Button1Click(TObject *Sender)
{
    int id;
    dm_data->ds_xiaopiao->Last();
    id=dm_data->ds_xiaopiao->FieldByName("id")->AsInteger+1;
    if(id>=29999)
        return;
    dm_data->ds_xiaopiao->Append();
    dm_data->ds_xiaopiao->FieldByName("id")->AsInteger=id;
    dm_data->ds_xiaopiao->Post();
}
//---------------------------------------------------------------------------

void __fastcall Tfm_xiaopiao::Button2Click(TObject *Sender)
{
    if(Application->MessageBoxA("真的要删除最后一行吗?","提示",MB_OKCANCEL)==IDOK)
    {
        if(dm_data->ds_xiaopiao->RecordCount==1) return;
        dm_data->ds_xiaopiao->Last();
        dm_data->ds_xiaopiao->DeleteRecords(arCurrent);
    }
}
//---------------------------------------------------------------------------


void __fastcall Tfm_xiaopiao::Button3Click(TObject *Sender)
{
    Close();    
}
//---------------------------------------------------------------------------


⌨️ 快捷键说明

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