⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmqrysp.cpp

📁 C++
💻 CPP
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "Frmqrysp.h"
#include "DmCSDemo.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TFrmQueryProc *FrmQueryProc;
//---------------------------------------------------------------------------
__fastcall TFrmQueryProc::TFrmQueryProc(TComponent* Owner)
  : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void TFrmQueryProc::WriteMsg(char *szWrite)
{
   StatusBar1->SimpleText = szWrite;
}
//---------------------------------------------------------------------------
void __fastcall TFrmQueryProc::FormShow(TObject *Sender)
{
  DmEmployee->EmployeeTable->Open();
  // Allow data flow from the EmployeeTable to the local EmployeeSource.  This
  //   will allow DataChange events to execute the query procedure
  EmployeeSource->Enabled = True;
  // Explicit query preparation is not required, but gives the best possible
  //  performance
  if (EmployeeProjectsQuery->Active != True)
     EmployeeProjectsQuery->Prepare();
}
//---------------------------------------------------------------------
void __fastcall TFrmQueryProc::EmployeeSourceDataChange(TObject *Sender,
      TField *Field)
{

  // Execute the ProjectsQuery, which uses a query procedure
  EmployeeProjectsQuery->Close();
  EmployeeProjectsQuery->ParamByName("EMP_NO")->AsSmallInt =
    DmEmployee->EmployeeTableEMP_NO->Value;
  EmployeeProjectsQuery->Open();

  String buf = "Employee "
             + String((int)DmEmployee->EmployeeTableEMP_NO->Value)
             + " is assigned to " 
             + String((int)EmployeeProjectsQuery->RecordCount)
             + " project(s)";
  WriteMsg(buf.c_str());
} 
//---------------------------------------------------------------------
void __fastcall TFrmQueryProc::FormHide(TObject *Sender)
{
   // Turn off the DataChange event for the form, since DmEmployee.EmployeeTable
   // is used elsewhere
   EmployeeSource->Enabled = True;
}
//---------------------------------------------------------------------

⌨️ 快捷键说明

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