📄 searchdlg.cpp
字号:
dlg.m_byxx=m_stuSet.m_byxxdm;
m_strSQL.Format("select * from tjk where ksh='%s'",m_KSH);
if(!m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE,m_strSQL))
{
MessageBox("打开数据库失败","连接失败",MB_OK);
return;
}
CHealManageApp* ptheApp = (CHealManageApp *) AfxGetApp();
ptheApp->m_ksId=m_KSH;
dlg.m_tjxh=m_recordset.m_tjxh;
dlg.m_jwbsT=m_recordset.m_jwbs;
dlg.m_lyslz.Format("%.1f",m_recordset.m_yk_lyslz);
dlg.m_lysly.Format("%.1f",m_recordset.m_yk_lysly);
dlg.m_jzslz.Format("%.1f",m_recordset.m_yk_jzslz);
dlg.m_jzsly.Format("%.1f",m_recordset.m_yk_jzsly);
dlg.m_jzdsz=m_recordset.m_yk_jzdsz;
dlg.m_jzdsy=m_recordset.m_yk_jzdsy;
dlg.m_yb=m_recordset.m_yk_yb;
dlg.m_sg.Format("%.1f",m_recordset.m_wk_sg);
dlg.m_tz.Format("%.1f",m_recordset.m_wk_tz);
dlg.m_nzssy=m_recordset.m_nk_xyssy;
dlg.m_nzszy=m_recordset.m_nk_xyszy;
dlg.m_gan=m_recordset.m_nk_g;
dlg.m_pi=m_recordset.m_nk_p;
dlg.m_nk=m_recordset.m_nk_qt;
dlg.m_wk=m_recordset.m_wk_qt;
dlg.m_ztl.Format("%.1f",m_recordset.m_eb_zetl);
dlg.m_ytl.Format("%.1f",m_recordset.m_eb_yetl);
dlg.m_eb=m_recordset.m_eb_ebyh_bz;
dlg.m_kq=m_recordset.m_kq_qt;
dlg.m_xt=m_recordset.m_xt_qt;
dlg.m_gg=m_recordset.m_gg_qt;
dlg.m_sxzy1=m_recordset.m_zysxdm1;
dlg.m_sxzy2=m_recordset.m_zysxdm2;
dlg.m_sxzy3=m_recordset.m_zysxdm3;
dlg.m_sxzy4=m_recordset.m_zysxdm4;
dlg.m_sxzy5=m_recordset.m_zysxdm5;
dlg.m_sxzy6=m_recordset.m_zysxdm6;
dlg.m_tjjl=m_recordset.m_bz;
m_stuSet.Close();
m_recordset.Close();
dlg.DoModal();
}
void CSearchDlg::OnView()
{
// TODO: Add your control notification handler code here
CString m_KSH;
CString m_strSQL;
CTiJSet m_recordset;
CString m_strBirth;
CStuInfoSet m_stuSet;
int i=m_csearch.GetSelectionMark();
if(i<0)
{
MessageBox("请选择一个要查看的记录!");
return;
}
m_KSH=m_csearch.GetItemText(i,0);
CDialog::OnOK();
m_strSQL.Format("select * from bjk where ksh='%s'",m_KSH);
if(!m_stuSet.Open(AFX_DB_USE_DEFAULT_TYPE,m_strSQL))
{
MessageBox("打开数据库失败","连接失败",MB_OK);
return;
}
CViewDialog dlg;
dlg.m_tjxh=m_recordset.m_tjxh;
dlg.m_ksh=m_stuSet.m_ksh;
dlg.m_xm=m_stuSet.m_xm;
dlg.m_xb=m_stuSet.m_xbdm;
m_strBirth.Format("%d-%d-%d",m_stuSet.m_csrq.GetYear(),m_stuSet.m_csrq.GetMonth(),m_stuSet.m_csrq.GetDay());
dlg.m_cerq=m_strBirth;
dlg.m_mz=m_stuSet.m_mzdm;
dlg.m_sfzh=m_stuSet.m_sfzh;
dlg.m_byxx=m_stuSet.m_byxxdm;
m_strSQL.Format("select * from tjk where ksh='%s'",m_KSH);
if(!m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE,m_strSQL))
{
MessageBox("打开数据库失败","连接失败",MB_OK);
return;
}
CHealManageApp* ptheApp = (CHealManageApp *) AfxGetApp();
ptheApp->m_ksId=m_KSH;
dlg.m_tjxh=m_recordset.m_tjxh;
dlg.m_jwbsT=m_recordset.m_jwbs;
dlg.m_lyslz.Format("%.1f",m_recordset.m_yk_lyslz);
dlg.m_lysly.Format("%.1f",m_recordset.m_yk_lysly);
dlg.m_jzslz.Format("%.1f",m_recordset.m_yk_jzslz);
dlg.m_jzsly.Format("%.1f",m_recordset.m_yk_jzsly);
dlg.m_jzdsz=m_recordset.m_yk_jzdsz;
dlg.m_jzdsy=m_recordset.m_yk_jzdsy;
dlg.m_yb=m_recordset.m_yk_yb;
dlg.m_sg.Format("%.1f",m_recordset.m_wk_sg);
dlg.m_tz.Format("%.1f",m_recordset.m_wk_tz);
dlg.m_nzssy=m_recordset.m_nk_xyssy;
dlg.m_nzszy=m_recordset.m_nk_xyszy;
dlg.m_gan=m_recordset.m_nk_g;
dlg.m_pi=m_recordset.m_nk_p;
dlg.m_nk=m_recordset.m_nk_qt;
dlg.m_wk=m_recordset.m_wk_qt;
dlg.m_ztl.Format("%.1f",m_recordset.m_eb_zetl);
dlg.m_ytl.Format("%.1f",m_recordset.m_eb_yetl);
dlg.m_eb=m_recordset.m_eb_ebyh_bz;
dlg.m_kq=m_recordset.m_kq_qt;
dlg.m_xt=m_recordset.m_xt_qt;
dlg.m_gg=m_recordset.m_gg_qt;
dlg.m_sxzy1=m_recordset.m_zysxdm1;
dlg.m_sxzy2=m_recordset.m_zysxdm2;
dlg.m_sxzy3=m_recordset.m_zysxdm3;
dlg.m_sxzy4=m_recordset.m_zysxdm4;
dlg.m_sxzy5=m_recordset.m_zysxdm5;
dlg.m_sxzy6=m_recordset.m_zysxdm6;
dlg.m_tjjl=m_recordset.m_bz;
if(dlg.DoModal()==IDOK)
{
}
m_stuSet.Close();
m_recordset.Close();
}
void CSearchDlg::OnAdd()
{
// TODO: Add your control notification handler code here
CDialog::OnOK();
CAddDialog dlg;
dlg.DoModal();
}
void CSearchDlg::OnGjsearch()
{
// TODO: Add your control notification handler code here
CString m_strSQL;
m_strSQL="select * from tjk where";
UpdateData(TRUE);
if(m_xb==0)
{
m_strSQL+=" xb='男'";
}
if(m_xb==1)
{
m_strSQL+=" xb='女'";
}
if(m_xb==2)
{
m_strSQL+=" xb='男' or xb='女'";
}
if(!m_zylysl1.IsEmpty())
{
m_strSQL+=" and yk_lyslz>="+m_zylysl1+"";
}
if(!m_zylysl2.IsEmpty())
{
m_strSQL+=" and yk_lyslz<="+m_zylysl2+"";
}
if((!m_zylysl1.IsEmpty())&&(!m_zylysl2.IsEmpty()))
{
if(atof(m_zylysl1)>atof(m_zylysl2))
{
AfxMessageBox("左眼裸眼视力应该由小到大进行搜索!");
m_czylysl.SetFocus();
UpdateData(FALSE);
return;
}
else
{
m_strSQL+=" and yk_lyslz>="+m_zylysl1+" and yk_lyslz<="+m_zylysl2+"";
}
}
if(!m_yylysl1.IsEmpty())
{
m_strSQL+=" and yk_lysly>="+m_yylysl1+"";
}
if(!m_yylysl2.IsEmpty())
{
m_strSQL+=" and yk_lysly<="+m_yylysl2+"";
}
if((!m_yylysl1.IsEmpty())&&(!m_yylysl2.IsEmpty()))
{
if(atof(m_yylysl1)>atof(m_yylysl2))
{
AfxMessageBox("右眼裸眼视力应该由小到大进行搜索!");
m_cyylysl.SetFocus();
UpdateData(FALSE);
return;
}
else
{
m_strSQL+=" and yk_lysly>="+m_zylysl1+" and yk_lysly<="+m_zylysl2+"";
}
}
if(!m_sg1.IsEmpty())
{
m_strSQL+=" and wk_sg>="+m_sg1+"";
}
if(!m_sg2.IsEmpty())
{
m_strSQL+=" and wk_sg<="+m_sg2+"";
}
if((!m_sg1.IsEmpty())&&(!m_sg2.IsEmpty()))
{
if(atof(m_sg1)>atof(m_sg2))
{
AfxMessageBox("身高应该由小到大进行搜索!");
m_csg.SetFocus();
UpdateData(FALSE);
return;
}
else
{
m_strSQL+=" and wk_sg>="+m_sg1+" and wk_sg<="+m_sg2+"";
}
}
if(!m_tz1.IsEmpty())
{
m_strSQL+=" and wk_tz>="+m_tz1+"";
}
if(!m_tz2.IsEmpty())
{
m_strSQL+=" and wk_tz<="+m_tz2+"";
}
if((!m_tz1.IsEmpty())&&(!m_tz2.IsEmpty()))
{
if(atof(m_tz1)>atof(m_tz2))
{
AfxMessageBox("体重应该由小到大进行搜索!");
m_ctz.SetFocus();
UpdateData(FALSE);
return;
}
else
{
m_strSQL+=" and wk_tz>="+m_tz1+" and wk_tz<="+m_tz2+"";
}
}
if(!m_ztl1.IsEmpty())
{
m_strSQL+=" and eb_zetl>="+m_ztl1+"";
}
if(!m_ztl2.IsEmpty())
{
m_strSQL+=" and eb_zetl<="+m_ztl2+"";
}
if((!m_ztl2.IsEmpty())&&(!m_ztl2.IsEmpty()))
{
if(atof(m_ztl1)>atof(m_ztl2))
{
AfxMessageBox("左耳听力应该由小到大进行搜索!");
m_cztl.SetFocus();
UpdateData(FALSE);
return;
}
else
{
m_strSQL+=" and eb_zetl>="+m_tz1+" and eb_zetl<="+m_tz2+"";
}
}
if(!m_ytl1.IsEmpty())
{
m_strSQL+=" and eb_yetl>="+m_ytl1+"";
}
if(!m_ytl2.IsEmpty())
{
m_strSQL+=" and eb_yetl<="+m_ytl2+"";
}
if((!m_ytl1.IsEmpty())&&(!m_ytl2.IsEmpty()))
{
if(atof(m_ytl1)>atof(m_ytl2))
{
AfxMessageBox("右耳听力应该由小到大进行搜索!");
m_cytl.SetFocus();
UpdateData(FALSE);
return;
}
else
{
m_strSQL+=" and eb_yetl>="+m_ytl1+" and eb_yetl<="+m_ytl2+"";
}
}
if(m_sj==TRUE)
{
m_strSQL+=" and yk_ysyj='正常'";
}
if(m_xj==TRUE)
{
m_strSQL+=" and eb_xj='正常'";
}
if(m_nk==TRUE)
{
m_strSQL+=" and nk_ysyj='正常'";
}
if(m_wk==TRUE)
{
m_strSQL+=" and wk_ysyj='正常'";
}
if(m_eb==TRUE)
{
m_strSQL+=" and eb_ysyj='正常'";
}
if(m_kq==TRUE)
{
m_strSQL+=" and kq_ysyj='正常'";
}
if(m_xt==TRUE)
{
m_strSQL+=" and xt_ysyj='正常'";
}
if(m_ggn==TRUE)
{
m_strSQL+=" and gg_ysyj='正常'";
}
RefreshData(m_strSQL);
UpdateData(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -