www.pudn.com > SingleNumber.rar > Unit4.cpp


//--------------------------------------------------------------------------- 
 
#include  
#pragma hdrstop 
 
#include "Unit4.h" 
#include "Unit1.h" 
//--------------------------------------------------------------------------- 
#pragma package(smart_init) 
#pragma resource "*.dfm" 
TForm4 *Form4; 
//--------------------------------------------------------------------------- 
__fastcall TForm4::TForm4(TComponent* Owner) 
        : TForm(Owner) 
{ 
} 
//--------------------------------------------------------------------------- 
 
 
void __fastcall TForm4::FormCreate(TObject *Sender) 
{ 
    this->ADOQuery1->Active=true; 
    this->Height=247; 
    this->Width=345; 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm4::Button1Click(TObject *Sender) 
{ 
   try 
   { 
      String sql="select * from hot where 1=1"; 
      if(this->Edit1->Text!="") sql=sql+" and Rank='"+this->Edit1->Text+"'"; 
      this->ADOQuery1->SQL->Clear(); 
      this->ADOQuery1->SQL->Add(sql); 
      this->ADOQuery1->ExecSQL(); 
      this->ADOQuery1->Close(); 
      this->ADOQuery1->Open(); 
    } 
    catch(...) 
    { 
 
    } 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm4::Button2Click(TObject *Sender) 
{ 
   try 
   { 
      String sql="select * from hot where 1=1"; 
      if(this->Edit2->Text!="") sql=sql+" and Rank='"+this->Edit2->Text+"'"; 
      this->ADOQuery1->SQL->Clear(); 
      this->ADOQuery1->SQL->Add(sql); 
      this->ADOQuery1->ExecSQL(); 
      this->ADOQuery1->Close(); 
      this->ADOQuery1->Open(); 
    } 
    catch(...) 
    { 
 
    } 
} 
//--------------------------------------------------------------------------- 
 
void __fastcall TForm4::Button3Click(TObject *Sender) 
{ 
   try 
   { 
      String sql="select * from hot where 1=1"; 
      if(this->Edit3->Text!="") sql=sql+" and Rank='"+this->Edit3->Text+"'"; 
      this->ADOQuery1->SQL->Clear(); 
      this->ADOQuery1->SQL->Add(sql); 
      this->ADOQuery1->ExecSQL(); 
      this->ADOQuery1->Close(); 
      this->ADOQuery1->Open(); 
    } 
    catch(...) 
    { 
 
    }   
} 
//---------------------------------------------------------------------------