📄 house.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "db.h"/////
#include "House.h"
#include "Charge.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm3 *Form3;
//---------------------------------------------------------------------------
__fastcall TForm3::TForm3(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm3::Button1Click(TObject *Sender)
{
try
{
Query1->Close();
Query1->SQL->Clear();
AnsiString strSQL="select sno,sname,zhuanye,deptName,houseNo ";
strSQL+="from Student,Department ";
strSQL+="where Student.deptNo=Department.deptNo ";
strSQL+="and sname like '%"+LabeledEdit1->Text+"%'";
Query1->SQL->Add(strSQL); //等价Query1->SQL->Text=strSQL;
//Query1->Prepare();//此语句可提高查询效率
Query1->ExecSQL();//执行语句
Query1->Open(); //打开表显示内容
if(Query1->RecordCount!=0)
MessageBox(Handle,"查询成功","信息提示",MB_OK);
else
MessageBox(Handle,"查无此人","信息提示",MB_OK);
}
catch (Exception &e)
{MessageBox(Handle,"查询失败","信息提示",MB_OK);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm3::Button2Click(TObject *Sender)
{
Form3->Close();
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -