📄 selwork9.cpp
字号:
// selwork9.cpp : implementation file
//
#include "stdafx.h"
#include "图书管理.h"
#include "selwork9.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// selwork9 dialog
selwork9::selwork9(CWnd* pParent /*=NULL*/)
: CDialog(selwork9::IDD, pParent)
{
EnableAutomation();
//{{AFX_DATA_INIT(selwork9)
m_workno = _T("");
m_workname = _T("");
m_dep = _T("");
//}}AFX_DATA_INIT
}
void selwork9::OnFinalRelease()
{
// When the last reference for an automation object is released
// OnFinalRelease is called. The base class will automatically
// deletes the object. Add additional cleanup required for your
// object before calling the base class.
CDialog::OnFinalRelease();
}
void selwork9::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(selwork9)
DDX_Control(pDX, IDC_COMBO1, m_sex);
DDX_Control(pDX, IDC_ADODC1, m_adoc);
DDX_Control(pDX, IDC_DATAGRID1, m_grid);
DDX_Text(pDX, IDC_EDIT1, m_workno);
DDX_Text(pDX, IDC_EDIT2, m_workname);
DDX_Text(pDX, IDC_STATIC1, m_dep);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(selwork9, CDialog)
//{{AFX_MSG_MAP(selwork9)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DISPATCH_MAP(selwork9, CDialog)
//{{AFX_DISPATCH_MAP(selwork9)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
// Note: we add support for IID_Iselwork9 to support typesafe binding
// from VBA. This IID must match the GUID that is attached to the
// dispinterface in the .ODL file.
// {FE3FFBF5-40F6-4F0F-9BC3-4D1F06F3A223}
static const IID IID_Iselwork9 =
{ 0xfe3ffbf5, 0x40f6, 0x4f0f, { 0x9b, 0xc3, 0x4d, 0x1f, 0x6, 0xf3, 0xa2, 0x23 } };
BEGIN_INTERFACE_MAP(selwork9, CDialog)
INTERFACE_PART(selwork9, IID_Iselwork9, Dispatch)
END_INTERFACE_MAP()
/////////////////////////////////////////////////////////////////////////////
// selwork9 message handlers
void selwork9::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
CString vSQL,string,string2,str3="";
int i,count=0;
if(m_sex.GetCurSel()>=0)
{
if(m_sex.GetCurSel()==0)
str3="男";
else
str3="女";
}
CString str[3],str2[3];
str[0]=m_workno; str2[0]="workno";
str[1]=m_workname; str2[1]="workname";
str[2]=str3; str2[2]="worksex";
vSQL="select *from work where ";
for(i=0;i<3;i++)
{
string="";
string2="";
if(str[i]!="")
{
string=str2[i]+"=";
switch(i)
{
case 0: string2="'"+m_workno+"'";count++;break;
case 1: string2="'"+m_workname+"'";count++;break;
case 2: string2="'"+str3+"'";count++;break;
}
if(count>1)
vSQL+=" AND "+string+string2;
else
vSQL+=string+string2;
}
}
string=vSQL;
m_adoc.SetRecordSource(string);
m_adoc.Refresh();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -