Разработка базы дискографии музыкальных коллективов, страница 9

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

void __fastcall TForm7::Button1Click(TObject *Sender)

{

if(ComboBox1->Text!="" && Edit1->Text!=""){

try{

ADOQuery1->SQL->Text="exec redgryp '" + Edit1->Text + "', '" + ComboBox1->Text + "'";

ADOQuery1->Open();

ADOQuery1->Refresh();

}

catch(Exception &E)

{

//ShowMessage(AnsiString(E.ClassName()) + " " + E.Message + " " );

}

}

else {

MessageBox(Handle,"Поля не должны быть пустыми","Не изменилось",48);

}

try{

ADOQuery1->SQL->Text="select * from k_gruppi";

ADOQuery1->Open();

ComboBox1->Items->Clear();

int n;

n=ADOQuery1->RecordCount;

ADOQuery1->First();

for (int i=0;i<n;i++)

{

ComboBox1->Items->Add(ADOQuery1->FieldByName("gruppa")->AsString);

ADOQuery1->Next();

}

}

catch(Exception &E)

{

//ShowMessage(AnsiString(E.ClassName()) + " " + E.Message + " " );

}

}

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

void __fastcall TForm7::ComboBox2Change(TObject *Sender)

{

ADOQuery1->SQL->Text="exec dobidgr '" + ComboBox2->Text +"'";;

try{

ADOQuery1->Open();

}

catch(Exception &E){

//ShowMessage(AnsiString(E.ClassName()) + " " + E.Message + " " );

}

ADOQuery2->SQL->Text="select * from gr";

try{

ADOQuery2->Open();

}

catch(Exception &E){

//ShowMessage(AnsiString(E.ClassName()) + " " + E.Message + " " );

}

ADOQuery3->SQL->Text="exec redsostav '" + ADOQuery2->FieldByName("identa")->AsString +"'";

try{

ADOQuery3->Open();

}

catch(Exception &E){

//ShowMessage(AnsiString(E.ClassName()) + " " + E.Message + " " );

}

}

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

void __fastcall TForm7::FormCreate(TObject *Sender)

{

ADOQuery2->Open();

}

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

void __fastcall TForm7::Button5Click(TObject *Sender)

{

Form7->Close();

Form1->Show();       

}

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

void __fastcall TForm7::Button3Click(TObject *Sender)

{

DBNavigator1->BtnClick(nbEdit);

}

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

void __fastcall TForm7::Button6Click(TObject *Sender)

{

DBNavigator1->BtnClick(nbPost);

}

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

void __fastcall TForm7::Button4Click(TObject *Sender)

{

DBNavigator1->BtnClick(nbDelete);

}

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

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

#include <vcl.h>

#pragma hdrstop

#include "Unit8.h"

#include "Unit1.h"

#include "Unit2.h"

#include "Unit7.h"

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

#pragma package(smart_init)

#pragma link "CGAUGES"

#pragma resource "*.dfm"

TForm8 *Form8;

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

__fastcall TForm8::TForm8(TComponent* Owner)

        : TForm(Owner)

{

}

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

void __fastcall TForm8::Button1Click(TObject *Sender)

{

CGauge1->Visible=true;

int i=0;

int nn;

nn=random(98)+1;

ADOQuery1->SQL->Text="exec logpas '" + Edit1->Text +"', '" + Edit2->Text + "'";

try{

ADOQuery1->Open();}

catch(Exception &E){

//ShowMessage(AnsiString(E.ClassName()) + " " + E.Message + " " );

}

ADOQuery2->SQL->Text="select * from pasw";

try{

ADOQuery2->Open();

if((ADOQuery2->FieldByName("identa")->AsString)==0){

for(int t=0; t<1000000000; t++){

//if(t<1000000000){

i++;//}

if(i==10000000){

CGauge1->AddProgress(1);

i=0;

if(CGauge1->Progress==nn){

t=10000000000;

MessageBox(Handle,"error","Идентификация",48);

/*ADOQuery1->Refresh();

ADOQuery2->Refresh();*/

CGauge1->Visible=false;

ADOQuery1->Close();

ADOQuery2->Close();

Form8->Close();

Form1->Show();}}}}

else if((ADOQuery2->FieldByName("identa")->AsString)>0){

int i=0;

for(int t=0; t<1000000000; t++){

i++;

if(i==10000000){

CGauge1->AddProgress(1);

i=0;}}

MessageBox(Handle,"ок","Идентификация",48);

if(Form1->mn==0){

Form2->Height=233;

Form2->Width=489;

Form8->Close();

CGauge1->Visible=false;

Form2->Show();}

if(Form1->mn==1){

Form7->GroupBox1->Visible=true;

Form7->GroupBox1->Enabled=true;

Form7->GroupBox2->Visible=false;

Form7->GroupBox2->Enabled=false;

try{

Form7->ADOQuery1->SQL->Text="select * from k_gruppi";

Form7->ADOQuery1->Open();

Form7->ComboBox1->Items->Clear();

int n;

n=Form7->ADOQuery1->RecordCount;

Form7->ADOQuery1->First();

for (int i=0;i<n;i++){

Form7->ComboBox1->Items->Add(Form7->ADOQuery1->FieldByName("gruppa")->AsString);

Form7->ADOQuery1->Next();}}

catch(Exception &E){

//ShowMessage(AnsiString(E.ClassName()) + " " + E.Message + " " );

}

CGauge1->Visible=false;

Form8->Close();

Form7->Show();}

if(Form1->mn==2){

Form7->GroupBox2->Visible=true;

Form7->GroupBox2->Enabled=true;