1. . Animals ( , ).
2. (DMod) TQuery (AnimalsQuery), TDataSource.
3. TQuery DatabaseName , Name AnimalsQuery, SQL :
Select * from Animals
where
Animals.Size >:Size and
Animals.Weight >:Weight
4. DataSource Name AnimalsDataSource, DataSet AnimalsQuery.
5. TDBGrid, 2 TListBox, TBBImage.
6. Label, Size Weight.
7. .
8. TDBImage DataSource, , DataField BMP ( ).
9. TDBGrid , .
10. (DMod) :
void TDMod::RunQuery(int Box1, int Box2)
{
AnimalsQuery->Close();
AnimalsQuery->Prepare();
AnimalsQuery->Params->Items[0]->AsInteger=Box1;
AnimalsQuery->Params->Items[1]->AsInteger=Box2;
AnimalsQuery->Open();
}
11. OnCreate:
void __fastcall TForm1::FormCreate(TObject *Sender)
{
int i;
AnsiString S;
for (i=0; i<40; i++)
{
S=i;
ListBox1->Items->Add(S);
ListBox2->Items->Add(S);
}
ListBox1->ItemIndex=0;
ListBox2->ItemIndex=0;
}
OnShow:
void __fastcall TForm1::FormShow(TObject *Sender)
{
DMod->RunQuery(0,0);
}
12. OnClick :
void __fastcall TForm1::ListBox1Click(TObject *Sender)
{
DMod->RunQuery(ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt(),
ListBox2->Items->Strings[ListBox2->ItemIndex}.ToInt());
}
13. . .