📄 selbook9.cpp
字号:
// selbook9.cpp : implementation file
//
#include "stdafx.h"
#include "图书管理.h"
#include "selbook9.h"
#include"book.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// selbook9 dialog
selbook9::selbook9(CWnd* pParent /*=NULL*/)
: CDialog(selbook9::IDD, pParent)
{
EnableAutomation();
//{{AFX_DATA_INIT(selbook9)
m_bookno = _T("");
m_bookname = _T("");
m_writer = _T("");
m_publish = _T("");
m_save = _T("");
m_saves = _T("");
m_dep = _T("");
//}}AFX_DATA_INIT
}
void selbook9::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 selbook9::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(selbook9)
DDX_Control(pDX, IDC_COMBO1, m_leixing);
DDX_Control(pDX, IDC_ADODC1, m_adoc);
DDX_Control(pDX, IDC_DATAGRID2, m_grid);
DDX_Text(pDX, IDC_EDIT1, m_bookno);
DDX_Text(pDX, IDC_EDIT2, m_bookname);
DDX_Text(pDX, IDC_EDIT4, m_writer);
DDX_Text(pDX, IDC_EDIT5, m_publish);
DDX_Text(pDX, IDC_EDIT6, m_save);
DDX_CBString(pDX, IDC_COMBO2, m_saves);
DDX_Text(pDX, IDC_STATIC1, m_dep);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(selbook9, CDialog)
//{{AFX_MSG_MAP(selbook9)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DISPATCH_MAP(selbook9, CDialog)
//{{AFX_DISPATCH_MAP(selbook9)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
// Note: we add support for IID_Iselbook9 to support typesafe binding
// from VBA. This IID must match the GUID that is attached to the
// dispinterface in the .ODL file.
// {A927FBB2-3983-42A7-A154-AC556CB36120}
static const IID IID_Iselbook9 =
{ 0xa927fbb2, 0x3983, 0x42a7, { 0xa1, 0x54, 0xac, 0x55, 0x6c, 0xb3, 0x61, 0x20 } };
BEGIN_INTERFACE_MAP(selbook9, CDialog)
INTERFACE_PART(selbook9, IID_Iselbook9, Dispatch)
END_INTERFACE_MAP()
/////////////////////////////////////////////////////////////////////////////
// selbook9 message handlers
void selbook9::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
CString vSQL,string,string2,str3="";
int i,count=0;
if(m_leixing.GetCurSel()>=0)
str3.Format("%d",m_leixing.GetCurSel()+1);
CString str[6],str2[6];
str[0]=m_bookno; str2[0]="bookno";
str[1]=m_bookname; str2[1]="bookname";
str[2]=m_writer; str2[2]="writer";
str[3]=m_publish; str2[3]="publish";
str[4]=str3; str2[4]="leixing";
str[5]=m_save; str2[5]="weizi";
vSQL="select *from book where ";
for(i=0;i<6;i++)
{
string="";
string2="";
if(str[i]!="")
{
string=str2[i]+"=";
switch(i)
{
case 0: string2="'"+m_bookno+"'";count++;break;
case 1: string2="'"+m_bookname+"'";count++;break;
case 2: string2="'"+m_writer+"'";count++;break;
case 3: string2="'"+m_publish+"'";count++;break;
case 4: string2="'"+str3+"'";count++;break;
case 5: string2="'"+m_save+"'";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 + -