Смекни!
smekni.com

База данных "Магазин по продаже дисков" (стр. 4 из 4)

DataSource1->DataSet = ADOQuery1;

ADOQuery1->Open();}

else

{if(RadioButton2->Checked)

{ADOQuery1->SQL->Add("SELECT * FROM Tab1 ORDER BY +["+ComboBox2->Text+"] ASC;");

ADOQuery1->ExecSQL();

DataSource1->DataSet = ADOQuery1;

ADOQuery1->Open();}}}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button3Click(TObject *Sender)

{if(RadioButton3->Checked)

{ADOQuery1->SQL->Clear();

ADOQuery1->SQL->Add("SELECT * FROM Tab1 WHERE [Наименование] "+ComboBox3->Text+"\""+Edit5->Text+"\";");

ADOQuery1->ExecSQL();

ADOQuery1->Open();

ComboBox3->Clear();

Edit5->Clear();}

else

{if(RadioButton4->Checked)

{ADOQuery1->SQL->Clear();

ADOQuery1->SQL->Add("SELECT * FROM Tab1 WHERE [Группа] "+ComboBox4->Text+"\""+ComboBox8->Text+"\";");

ADOQuery1->ExecSQL();

ADOQuery1->Open();

ComboBox4->Clear();

ComboBox8->Clear();}

else

{if(RadioButton5->Checked)

{ADOQuery1->SQL->Clear();

ADOQuery1->SQL->Add("SELECT * FROM Tab1 WHERE [Количество] "+ComboBox5->Text+" "+Edit7->Text+";");

ADOQuery1->ExecSQL();

ADOQuery1->Open();

ComboBox5->Clear();

Edit7->Clear();}

else

{if(RadioButton6->Checked)

{ADOQuery1->SQL->Clear();

ADOQuery1->SQL->Add("SELECT * FROM Tab1 WHERE [Закупочная цена] "+ComboBox6->Text+" "+Edit8->Text+";");

ADOQuery1->ExecSQL();

ADOQuery1->Open();

ComboBox6->Clear();

Edit8->Clear();}

else

{if(RadioButton7->Checked)

{ADOQuery1->SQL->Clear();

ADOQuery1->SQL->Add("SELECT * FROM Tab1 WHERE [Цена продажи] "+ComboBox7->Text+" "+Edit9->Text+";");

ADOQuery1->ExecSQL();

ADOQuery1->Open();

ComboBox7->Clear();

Edit9->Clear();}

else

{MessageDlg("Укажите хотя бы одно поле..."mtInformation,TMsgDlgButtons()<<mbOK,0);}}}}}}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button4Click(TObject *Sender)

{if(Edit10->Text!="")

{//MessageDlg("Укажите не достаюшие поля..."mtInformation,TMsgDlgButtons()<<mbOK,0);}

ADOQuery1->SQL->Clear();

ADOQuery1->SQL->Add("SELECT * FROM Tab1 WHERE [Наименование] =&bsol;""+Edit10->Text+"&bsol;";");

ADOQuery1->ExecSQL();

ADOQuery1->Open();

Edit10->Clear();} else

{MessageDlg("Укажите не достаюшие поля..."mtInformation,TMsgDlgButtons()<<mbOK,0);}}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button5Click(TObject *Sender)

{ADOQuery1->Delete();}

//---------------------------------------------------------------------------