dangan.cpp
来自「脑电信号分析软件」· C++ 代码 · 共 113 行
CPP
113 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "dangan.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm_dangan *Form_dangan;
//---------------------------------------------------------------------------
__fastcall TForm_dangan::TForm_dangan(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm_dangan::FormCreate(TObject *Sender)
{ String databasepath;
databasepath= ExtractFilePath(Application->ExeName)+"dangan.mdb";
if (ADOConnection1->Connected==false)
{ADOConnection1->ConnectionString ="Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=" + databasepath + ";Mode=Share Deny None;Extended Properties="";Persist Security Info=False;Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False";
}
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("SELECT * FROM Pinfo " );
ADOQuery1->Open();
}
//---------------------------------------------------------------------------
void __fastcall TForm_dangan::Button_cxClick(TObject *Sender)
{
if(CheckBox_xm->Checked==false && CheckBox_bh->Checked==false)
{Application->MessageBox("请先选择查询条件!","查询提示",MB_OK);
goto Jump;
}
if(CheckBox_xm->Checked==true && CheckBox_bh->Checked==true)
{Application->MessageBox("只能选择一种查询条件!","查询提示",MB_OK);
goto Jump;
}
if (CheckBox_xm->Checked==true)
{if(ComboBox_xm->Text =="")
{Application->MessageBox("请输入要查询档案的姓名!","查询提示",MB_OK);
goto Jump;
}
else
{ ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("SELECT * FROM Pinfo WHERE 姓名='" + ComboBox_xm->Text+"'");
ADOQuery1->Open();
}
}
if (CheckBox_bh->Checked==true)
{if(ComboBox_bh->Text =="")
{Application->MessageBox("请输入要查询档案的编号!","查询提示",MB_OK);
goto Jump;
}
else
{ ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("SELECT * FROM Pinfo WHERE 编号='" + ComboBox_bh->Text + "'");
ADOQuery1->Open();
}
}
/*if (CheckBox_rq->Checked==true)
{ ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("SELECT * FROM Pinfo WHERE 日期= :(DateTimePicker1->Date)" );
ADOQuery1->Open();
}*/
if (ADOQuery1->Eof==true)
{Application->MessageBox("档案中无您要查询的记录!","查询提示",MB_OK);
goto Jump;
}
DataSource1->DataSet=ADOQuery1;
ADOQuery1->Open();
Jump:
}
//---------------------------------------------------------------------------
void __fastcall TForm_dangan::Button_gjcxClick(TObject *Sender)
{
if(CheckBox_xm->Checked==false || CheckBox_bh->Checked==false)
{Application->MessageBox("两种查询条件必须选中!","查询提示",MB_OK);
goto Jump;
}
if(ComboBox_bh->Text =="")
{Application->MessageBox("请输入要查询档案的编号!","查询提示",MB_OK);
goto Jump;
}
if(ComboBox_bh->Text =="")
{Application->MessageBox("请输入要查询档案的编号!","查询提示",MB_OK);
goto Jump;
}
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("SELECT * FROM Pinfo WHERE 编号='" + ComboBox_bh->Text + "'and 姓名='" + ComboBox_xm->Text+"'");
ADOQuery1->Open();
//ADOTable1->Open();
//ADOTable1->Filter= "编号=" + ComboBox_bh->Text + "and 姓名=" + ComboBox_xm->Text;
//ADOTable1->Filtered=true;
if (ADOQuery1->Eof==true)
{Application->MessageBox("档案中无您要查询的记录!","查询提示",MB_OK);
goto Jump;
}
DataSource1->DataSet=ADOQuery1;
ADOQuery1->Open();
Jump:
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?