Unit1.cpp
上传用户:lhxd_sz
上传日期:2014-10-02
资源大小:38814k
文件大小:1k
源码类别:

VC书籍

开发平台:

C++ Builder

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma resource "*.dfm"
  8. TForm1 *Form1;
  9. //---------------------------------------------------------------------------
  10. __fastcall TForm1::TForm1(TComponent* Owner)
  11.         : TForm(Owner)
  12. {
  13. }
  14. //---------------------------------------------------------------------------
  15. void __fastcall TForm1::Button1Click(TObject *Sender)
  16. {
  17.   AnsiString ass,tabname;
  18.   tabname="test.dbf";
  19.   Query1->Active=False;
  20.   Query1->SQL->Clear();
  21.   Query1->SQL->Add("SELECT *");
  22.   ass="FROM ""+tabname+"" tab";
  23.   Query1->SQL->Add(ass);
  24.   Query1->SQL->Add("WHERE 科目代码='"+Edit1->Text+"'");
  25.   Query1->SQL->Add("ORDER BY 科目代码");
  26.   Query1->Active=True;
  27. }
  28. //---------------------------------------------------------------------------
  29. void __fastcall TForm1::Button2Click(TObject *Sender)
  30. {
  31.   AnsiString ass,tabname;
  32.   tabname="test.dbf";
  33.   Query1->Active=False;
  34.   Query1->SQL->Clear();
  35.   Query1->SQL->Add("SELECT *");
  36.   ass="FROM ""+tabname+"" tab";
  37.   Query1->SQL->Add(ass);
  38.   Query1->SQL->Add("WHERE 科目代码 LIKE '%"+Edit1->Text+"%'");
  39.   Query1->SQL->Add("ORDER BY 科目代码");
  40.   Query1->Active=True;
  41. }
  42. //---------------------------------------------------------------------------