?? unit1.cpp
字號(hào):
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString ass;
ass=Table1->FieldByName("科目代碼")->AsString;
if(Application->MessageBox(("一定要?jiǎng)h除科目代碼為:"+ass+" 的記錄嗎?").c_str(),"提示",MB_YESNO)==IDYES)
Table1->Delete();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
AnsiString filename,oldkmno;
filename="test.dbf";
oldkmno=Table1->FieldByName("科目代碼")->AsString;
if(Application->MessageBox(("一定要?jiǎng)h除科目代碼為:"+oldkmno+" 的記錄嗎?").c_str(),"提示",MB_YESNO)!=IDYES)return;
Query1->Active=False;
Query1->SQL->Clear();
Query1->SQL->Add("DELETE FROM \""+filename+"\"");
Query1->SQL->Add("WHERE 科目代碼='"+oldkmno+"'");
Query1->ExecSQL();
if(Query1->RowsAffected>=1)
ShowMessage("記錄刪除成功!");
}
//---------------------------------------------------------------------------
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -