customserach.cpp

来自「机器须安装SQL Server2000 程序安装完之后」· C++ 代码 · 共 66 行

CPP
66
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "CustomSerach.h"
#include "DataMoudle.h"
#include "Main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TCustomSearchForm *CustomSearchForm;
//---------------------------------------------------------------------------
__fastcall TCustomSearchForm::TCustomSearchForm(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TCustomSearchForm::BtnSearchClick(TObject *Sender)
{
    if(RadioButton1->Checked == true)
    {
        ADOQueryTemp->Active = false;
        ADOQueryTemp->SQL->CommaText="select * from custom where name="+QuotedStr(ComboBox1->Text);
        ADOQueryTemp->Active = true;
    }
     if(RadioButton2->Checked == true)
    {
        ADOQueryTemp->Active = false;
        ADOQueryTemp->SQL->CommaText = "select * from custom where Province="+QuotedStr(ComboBox1->Text);
        ADOQueryTemp->Active = true;
    }

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


void __fastcall TCustomSearchForm::FormClose(TObject *Sender,
      TCloseAction &Action)
{
    Action = caFree;
    MainForm->CustomSearch = 0;
}
//---------------------------------------------------------------------------


void __fastcall TCustomSearchForm::RadioButton2Click(TObject *Sender)
{
     ADOQueryPro->Active = true;
        while ( !ADOQueryPro->Eof )
        {
            ComboBox1->Items->Add( ADOQueryPro->FieldByName( "Province" )->AsString );
            ADOQueryPro->Next();
        }
        ADOQueryPro->Active = false;
}
//---------------------------------------------------------------------------

void __fastcall TCustomSearchForm::RadioButton1Click(TObject *Sender)
{
    ComboBox1->Items->Clear();
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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