//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TableZYBMAfterScroll(TDataSet *DataSet)
{
QueryBJBM->Active=false;
QueryBJBM->ParamByName("ZYBM")->AsString=
TableZYBM->FieldByName("ZYBM")->AsString;
QueryBJBM->Active=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
QueryBJBM->Active=false;
QueryBJBM->ParamByName("ZYBM")->AsString=
TableZYBM->FieldByName("ZYBM")->AsString;
QueryBJBM->Active=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
QueryXQKC2->Close();
QueryXQKC2->ParamByName("XNXQ")->AsString=
ComboBox1->Items->Strings[ComboBox1->ItemIndex]+"/"+
ComboBox2->Items->Strings[ComboBox2->ItemIndex];
QueryXQKC2->ParamByName("BJMC")->AsString=
QueryBJBM->FieldByName("BJMC")->AsString;
QueryXQKC2->ParamByName("KCMC")->AsString=
QueryKCBM->FieldByName("KCMC")->AsString;
QueryXQKC2->Open();
if(QueryXQKC2->RecordCount==0)
{
QueryInsert->ParamByName("XNXQ")->AsString=
ComboBox1->Items->Strings[ComboBox1->ItemIndex]+"/"+
ComboBox2->Items->Strings[ComboBox2->ItemIndex];
QueryInsert->ParamByName("BJMC")->AsString=
QueryBJBM->FieldByName("BJMC")->AsString;
QueryInsert->ParamByName("KCMC")->AsString=
QueryKCBM->FieldByName("KCMC")->AsString;
QueryInsert->ExecSQL();
QueryXQKC->Close();
QueryXQKC->Open();
}else{
ShowMessage("该数据已经存在!");
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
if(MessageBox(Handle,"真的要删除?","警告",
MB_OKCANCEL+MB_ICONWARNING)==IDOK){
QueryDelete->ParamByName("XNXQ")->AsString=
QueryXQKC->FieldByName("XNXQ")->AsString;
QueryDelete->ParamByName("BJMC")->AsString=
QueryXQKC->FieldByName("BJMC")->AsString;
QueryDelete->ParamByName("KCMC")->AsString=
QueryXQKC->FieldByName("KCMC")->AsString;
QueryDelete->ExecSQL();
QueryXQKC->Close();
QueryXQKC->Open();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox2Click(TObject *Sender)
{
QueryXQKC->Filter="XNXQ='"+
ComboBox1->Items->Strings[ComboBox1->ItemIndex]+"/"+
ComboBox2->Items->Strings[ComboBox2->ItemIndex]+
"'";
QueryXQKC->Filtered=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox1Click(TObject *Sender)
{
QueryXQKC->Filter="XNXQ='"+
ComboBox1->Items->Strings[ComboBox1->ItemIndex]+"/"+
ComboBox2->Items->Strings[ComboBox2->ItemIndex]+
"'";
QueryXQKC->Filtered=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)
{
if(MessageDlg("确定退出程序?",mtConfirmation,
TMsgDlgButtons() << mbOK << mbCancel, 0)==mrCancel)
CanClose=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
Form2->QuickRep1->Preview();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
QueryXQKC->Close();
QueryXQKC->SQL->Clear();
QueryXQKC->SQL->Add("Select XNXQ from XQKC");
QueryXQKC->Open();
}
//---------------------------------------------------------------------------